[Gnucash-changes] r13596 - meta/hooks - encode the from address, too, for Andreas Köhler to work.

Derek Atkins warlord at cvs.gnucash.org
Sat Mar 11 10:45:23 EST 2006


Author: warlord
Date: 2006-03-11 10:45:23 -0500 (Sat, 11 Mar 2006)
New Revision: 13596
Trac: http://svn.gnucash.org/trac/changeset/13596

Modified:
   meta/hooks/commit-email.pl
Log:
encode the from address, too, for Andreas Köhler to work.


Modified: meta/hooks/commit-email.pl
===================================================================
--- meta/hooks/commit-email.pl	2006-03-11 15:23:19 UTC (rev 13595)
+++ meta/hooks/commit-email.pl	2006-03-11 15:45:23 UTC (rev 13596)
@@ -457,25 +457,9 @@
 
     my @head;
     push(@head, "To: $to\n");
-    push(@head, "From: $mail_from\n");
-    unless ($subject =~ m/^[[:ascii:]]*$/) {
-	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;
-    }
+    $mail_from_str = header_encode($mail_from);
+    push(@head, "From: $mail_from_str\n");
+    $subject = header_encode($subject);
     push(@head, "Subject: $subject\n");
     push(@head, "Reply-to: $reply_to\n") if $reply_to;
 
@@ -654,3 +638,29 @@
       return @output;
     }
 }
+
+# Convert a "header" string with UTF8 to the appropriate format
+sub header_encode
+{
+    my ($header) = @_;
+
+    unless ($header =~ m/^[[:ascii:]]*$/) {
+	my $newsub="";
+	my $space="";
+	foreach my $s (split ('\s', $header)) {
+	    $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=" ";
+	}
+	$header = $newsub;
+    }
+    return $header;
+}



More information about the gnucash-changes mailing list