[Gnucash-changes] r11955 - meta/hooks - Proper RFC2047 support for utf-8 email subjects.

Derek Atkins warlord at cvs.gnucash.org
Tue Nov 15 21:04:23 EST 2005


Author: warlord
Date: 2005-11-15 21:04:23 -0500 (Tue, 15 Nov 2005)
New Revision: 11955
Trac: http://svn.gnucash.org/trac/changeset/11955

Modified:
   meta/hooks/commit-email.pl
Log:
Proper RFC2047 support for utf-8 email subjects.
Tested to actually work in emacs.  Hopefully this works properly now.


Modified: meta/hooks/commit-email.pl
===================================================================
--- meta/hooks/commit-email.pl	2005-11-16 01:22:03 UTC (rev 11954)
+++ meta/hooks/commit-email.pl	2005-11-16 02:04:23 UTC (rev 11955)
@@ -459,7 +459,22 @@
     push(@head, "To: $to\n");
     push(@head, "From: $mail_from\n");
     unless ($subject =~ m/^[[:ascii:]]*$/) {
-	$subject = "=?utf-8?Q?" . encode_qp($subject, "");
+	my $newsub="";
+	my $space="";
+	foreach my $s (split ('\s', $subject)) {
+	    $newsub .= $space;
+	    if ($s =~ m/^[[:ascii:]]*$/) {
+		$newsub .= $s;
+	    } else {
+		# RFC2407
+		my $qp = encode_qp($s, "");
+		$qp =~ s/\?/=3F/g;
+		$qp =~ s/_/=5F/g;
+		$newsub .= "=?utf-8?q?$qp?=";
+	    }
+	    $space=" ";
+	}
+	$subject = $newsub;
     }
     push(@head, "Subject: $subject\n");
     push(@head, "Reply-to: $reply_to\n") if $reply_to;



More information about the gnucash-changes mailing list