Skip to content

Commit

Permalink
send-email: work around double encoding of in-body From field.
Browse files Browse the repository at this point in the history
git-send-email sends out the message taken from format-patch
output without quoting nor encoding.  When copying the From:
line to form in-body From: field, it should not copy it
verbatim, because the From: for the header is quoted according
to RFC 2047 when not ASCII.

The original came from Jürgen Rühle, but I moved the
string munging into a separate function so that later other
people can tweak it more easily.  Bugs introduced during the
translation are mine.

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Jürgen Rühle authored and Junio C Hamano committed Jan 10, 2007
1 parent c2cb959 commit 374c590
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions git-send-email.perl
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,15 @@ sub make_message_id
$cc = "";
$time = time - scalar $#files;

sub unquote_rfc2047 {
local ($_) = @_;
if (s/=\?utf-8\?q\?(.*)\?=/$1/g) {
s/_/ /g;
s/=([0-9A-F]{2})/chr(hex($1))/eg;
}
return "$_ - unquoted";
}

sub send_message
{
my @recipients = unique_email_list(@to);
Expand Down Expand Up @@ -555,6 +564,7 @@ sub send_message
}
close F;
if (defined $author_not_sender) {
$author_not_sender = unquote_rfc2047($author_not_sender);
$message = "From: $author_not_sender\n\n$message";
}

Expand Down

0 comments on commit 374c590

Please sign in to comment.