[evolvis-commits] r17277: merge bm:taramir/patches/oncommit

mirabilos at evolvis.org mirabilos at evolvis.org
Thu May 26 14:07:47 CEST 2011


Author: mirabilos
Date: 2011-05-26 14:07:47 +0200 (Thu, 26 May 2011)
New Revision: 17277

Modified:
   trunk/gforge_base/evolvisforge/gforge/debian/changelog
   trunk/gforge_base/evolvisforge/gforge/plugins/scmsvn/etc/plugins/scmsvn/commit-email.pl
Log:
merge bm:taramir/patches/oncommit

Modified: trunk/gforge_base/evolvisforge/gforge/debian/changelog
===================================================================
--- trunk/gforge_base/evolvisforge/gforge/debian/changelog	2011-05-23 10:54:48 UTC (rev 17276)
+++ trunk/gforge_base/evolvisforge/gforge/debian/changelog	2011-05-26 12:07:47 UTC (rev 17277)
@@ -16,8 +16,9 @@
   * [#824] Standard configuration for Tracker Custom Fields
   * [TTID# 1111894] Update tarent GmbH information
   * [#1644] [#1645] Disable paging in PM/Tasks altogether
+  * Fix Subject line encoding in SVN commit eMails
 
- -- Thorsten Glaser <t.glaser at tarent.de>  Fri, 20 May 2011 13:22:12 +0200
+ -- Thorsten Glaser <t.glaser at tarent.de>  Thu, 26 May 2011 14:06:05 +0200
 
 gforge (4.8.3+evolvis33) unstable; urgency=high
 

Modified: trunk/gforge_base/evolvisforge/gforge/plugins/scmsvn/etc/plugins/scmsvn/commit-email.pl
===================================================================
--- trunk/gforge_base/evolvisforge/gforge/plugins/scmsvn/etc/plugins/scmsvn/commit-email.pl	2011-05-23 10:54:48 UTC (rev 17276)
+++ trunk/gforge_base/evolvisforge/gforge/plugins/scmsvn/etc/plugins/scmsvn/commit-email.pl	2011-05-26 12:07:47 UTC (rev 17277)
@@ -5,6 +5,26 @@
 #	Thorsten Glaser <t.glaser at tarent.de>
 # Available under the same terms as reproduced below.
 
+sub util_encode_mimeheader {
+	my ($headername, $str, $charset) = @_;
+
+	# compose header line sans trailing newline
+	$headername .= ": " . $str;
+	# make PHP string ('…') out of header line
+	$headername =~ s/\\/\\\\/g;
+	$headername =~ s/\'/\\\'/g;
+	# compose PHP script
+	$str = 'mb_internal_encoding("UTF-8"); ' .
+	    'echo mb_encode_mimeheader(' . "'" .
+	    $headername . "', '" . $charset . "', 'Q')." .
+	    # this adds the trailing newline after encoding
+	    '"\n";';
+	# escape ('…') PHP script from shell
+	$str =~ s/\'/\'\\\'\'/g;
+	# do the deed
+	return qx(php -r '$str');
+}
+
 # ====================================================================
 # commit-email.pl: send a notification email describing either a
 # commit or a revprop-change action on a Subversion repository.
@@ -75,7 +95,6 @@
 use strict;
 use Carp;
 use POSIX qw(strftime);
-use Encode;
 my ($sendmail, $smtp_server);
 
 ######################################################################
@@ -612,13 +631,10 @@
       }
     $formatted_date = strftime('%a, %e %b %Y %X %z', localtime());
 
-    # EvolvisForge bugfix
-    Encode::from_to($subject, "UTF-8", "MIME-Q");
-
     push(@head, "Date: $formatted_date\n");
     push(@head, "To: $to\n");
     push(@head, "From: $mail_from\n");
-    push(@head, "Subject: $subject\n");
+    push(@head, util_encode_mimeheader("Subject", $subject, "UTF-8"));
     push(@head, "Reply-to: $reply_to\n") if $reply_to;
 
     ### Below, we set the content-type etc, but see these comments



More information about the evolvis-commits mailing list