diff options
author | Jürgen Rühle <j-r@online.de> | 2007-01-10 13:36:39 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2007-01-10 13:39:16 -0800 |
commit | 374c59056a0719fe1244280cdb6fdce48672f441 (patch) | |
tree | 931fabdb7941e448f6bdf9396af8a13d77c67bf8 /git-send-email.perl | |
parent | c2cb959fe7c7e5736cead7edf2b69be7e072a543 (diff) | |
download | git-374c59056a0719fe1244280cdb6fdce48672f441.tar.gz |
send-email: work around double encoding of in-body From field.
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>
Diffstat (limited to 'git-send-email.perl')
-rwxr-xr-x | git-send-email.perl | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/git-send-email.perl b/git-send-email.perl index ba39d39384..8dc2ee0cf7 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -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); @@ -555,6 +564,7 @@ foreach my $t (@files) { } close F; if (defined $author_not_sender) { + $author_not_sender = unquote_rfc2047($author_not_sender); $message = "From: $author_not_sender\n\n$message"; } |