CVSROOT: cvslog.pl - encode subject header

glen glen at pld-linux.org
Wed May 7 18:22:00 CEST 2008


Author: glen                         Date: Wed May  7 16:22:00 2008 GMT
Module: CVSROOT                       Tag: HEAD
---- Log message:
- encode subject header

---- Files affected:
CVSROOT:
   cvslog.pl (1.77 -> 1.78) 

---- Diffs:

================================================================
Index: CVSROOT/cvslog.pl
diff -u CVSROOT/cvslog.pl:1.77 CVSROOT/cvslog.pl:1.78
--- CVSROOT/cvslog.pl:1.77	Wed May  7 17:20:40 2008
+++ CVSROOT/cvslog.pl	Wed May  7 18:21:55 2008
@@ -32,12 +32,21 @@
 use vars qw ($project $repository $from_email $dest_email $reply_email
 		$CVS $diffstat $cvsweb_url $help_msg $sync_delay $max_diff_lines
 		$show_diffstat $show_diff $login $subj_files $subj_maxlength
-		$withthreading_email $messageid_email $mail_contenttype $mail_contenttransen $old_cmdargs);
-
-
+		$withthreading_email $messageid_email $mail_contenttransen $old_cmdargs);
 
+# encode rfc822 email header
+eval {
+  require MIME::Words;
+  import MIME::Words;
+};
+if ($@) {
+  sub MIME::Words::encode_mimewords {
+	return $_[0];
+  }
+}
 
 ### Configuration
+my $charset = 'iso8859-2';
 
 # Project name.
 $project = 'PLD';
@@ -67,9 +76,6 @@
 # with threading?
 $withthreading_email = 1;
 
-# mail content-type
-$mail_contenttype="text/plain; charset=iso-8859-2";
-
 # mail content-transfer-encoding
 $mail_contenttransen="8bit";
 
@@ -210,7 +216,7 @@
 
 # TODO: set this based on some kind of content charset detection
 if ($htag eq "HEAD" || $htag =~ /^LINUX_2_6/ || $htag =~ /^AC-branch/ || $htag eq "DEVEL" || $htag eq "MYSQL_5_0") {
-  $mail_contenttype = "text/plain; charset=utf-8";
+  $charset = 'utf-8';
 }
 
 while (<STDIN>) {
@@ -381,6 +387,8 @@
 $subj = substr($subj, 0, $subj_maxlength-3) . '...' if (length($subj) > $subj_maxlength);
 my $keywords="DEV-$user, MOD-$module, TAG-".($tag?$tag:"HEAD").", ". $subj_file_list;
 
+$subj = MIME::Words::encode_mimewords($subj, $charset);
+
 print MAIL <<EOM;
 From: $from_email
 To: $dest_email
@@ -392,7 +400,7 @@
 Message-ID: $messageid
 MIME-Version: 1.0
 Content-Transfer-Encoding: $mail_contenttransen
-Content-Type: $mail_contenttype
+Content-Type: text/plain; charset=$charset
 Keywords: $keywords
 EOM
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/CVSROOT/cvslog.pl?r1=1.77&r2=1.78&f=u



More information about the pld-cvs-commit mailing list