From: Jeff King Date: Tue, 25 Mar 2008 23:03:21 GMT Subject: [PATCH 2/2] send-email: rfc2047-quote subject lines with non-ascii characters Message-ID: <20080325230321.GB17744@coredump.intra.peff.net> In-Reply-To: <7caf19ae394accab538d2f94953bb62b55a2c79f.1206486012.git.peff@peff.net> We always use 'utf-8' as the encoding, since we currently have no way of getting the information from the user. This also refactors the quoting of recipient names, since both processes can share the rfc2047 quoting code. Signed-off-by: Jeff King --- git-send-email.perl | 18 +++++++++++++++--- t/t9001-send-email.sh | 15 +++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/git-send-email.perl b/git-send-email.perl index 7c4f06c..075cd0b 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -501,7 +501,12 @@ if ($compose) { open(C,">",$compose_filename) or die "Failed to open for writing $compose_filename: $!"; print C "From $sender # This line is ignored.\n"; - printf C "Subject: %s\n\n", $initial_subject; + print C "Subject: ", + ($initial_subject =~ /[^[:ascii:]]/ ? + quote_rfc2047($initial_subject) : + $initial_subject), + "\n"; + print C "\n"; printf C <