{"thread":{"id":"31896","subject":"[PATCH] git-send-email: use compose-encoding for Subject","startedAt":"2012-10-22T12:41:48Z","lastAt":"2012-10-22T12:41:48Z","messageCount":1,"participants":["Krzysztof Mazur"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"201686","messageId":"1350909708-32241-1-git-send-email-krzysiek@podlesie.net","threadId":"31896","inReplyTo":null,"subject":"[PATCH] git-send-email: use compose-encoding for Subject","fromName":"Krzysztof Mazur","fromEmail":"krzysiek@podlesie.net","sentAt":"2012-10-22T12:41:48Z","receivedAt":"2012-10-22T12:41:48Z","isPatch":true,"sender":{"key":"krzysiek@podlesie.net","avatar":null},"body":"The commit \"git-send-email: introduce compose-encoding\" introduced\nthe compose-encoding option to specify the introduction email encoding\n(--compose option), but the email Subject encoding was still hardcoded\nto UTF-8.\n\nSigned-off-by: Krzysztof Mazur <krzysiek@podlesie.net>\n---\nPatch against km/send-email-compose-encoding\n(commit 62e0069056ed11294c29bae25df69b6518f6339e). Cleanly applies to current\nnext (commit 291341ca77d902dc76e204a3fc498a155f0ab75d)\n\n git-send-email.perl   |  8 ++++----\n t/t9001-send-email.sh | 14 ++++++++++++++\n 2 files changed, 18 insertions(+), 4 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 107e814..adcb4e3 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -636,15 +636,15 @@ EOT\n \tmy $need_8bit_cte = file_has_nonascii($compose_filename);\n \tmy $in_body = 0;\n \tmy $summary_empty = 1;\n+\tif (!defined $compose_encoding) {\n+\t\t$compose_encoding = \"UTF-8\";\n+\t}\n \twhile(<$c>) {\n \t\tnext if m/^GIT:/;\n \t\tif ($in_body) {\n \t\t\t$summary_empty = 0 unless (/^\\n$/);\n \t\t} elsif (/^\\n$/) {\n \t\t\t$in_body = 1;\n-\t\t\tif (!defined $compose_encoding) {\n-\t\t\t\t$compose_encoding = \"UTF-8\";\n-\t\t\t}\n \t\t\tif ($need_8bit_cte) {\n \t\t\t\tprint $c2 \"MIME-Version: 1.0\\n\",\n \t\t\t\t\t \"Content-Type: text/plain; \",\n@@ -658,7 +658,7 @@ EOT\n \t\t\tmy $subject = $initial_subject;\n \t\t\t$_ = \"Subject: \" .\n \t\t\t\t($subject =~ /[^[:ascii:]]/ ?\n-\t\t\t\t quote_rfc2047($subject) :\n+\t\t\t\t quote_rfc2047($subject, $compose_encoding) :\n \t\t\t\t $subject) .\n \t\t\t\t\"\\n\";\n \t\t} elsif (/^In-Reply-To:\\s*(.+)\\s*$/i) {\ndiff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\nindex 265ae04..89fceda 100755\n--- a/t/t9001-send-email.sh\n+++ b/t/t9001-send-email.sh\n@@ -909,6 +909,20 @@ test_expect_success $PREREQ '--compose-encoding overrides sendemail.composeencod\n \tgrep \"^Content-Type: text/plain; charset=iso-8859-2\" msgtxt1\n '\n \n+test_expect_success $PREREQ '--compose-encoding adds correct MIME for subject' '\n+\tclean_fake_sendmail &&\n+\t  GIT_EDITOR=\"\\\"$(pwd)/fake-editor\\\"\" \\\n+\t  git send-email \\\n+\t  --compose-encoding iso-8859-2 \\\n+\t  --compose --subject utf8-sübjëct \\\n+\t  --from=\"Example <nobody@example.com>\" \\\n+\t  --to=nobody@example.com \\\n+\t  --smtp-server=\"$(pwd)/fake.sendmail\" \\\n+\t  $patches &&\n+\tgrep \"^fake edit\" msgtxt1 &&\n+\tgrep \"^Subject: =?iso-8859-2?q?utf8-s=C3=BCbj=C3=ABct?=\" msgtxt1\n+'\n+\n test_expect_success $PREREQ 'detects ambiguous reference/file conflict' '\n \techo master > master &&\n \tgit add master &&\n-- \n1.8.0.2.g35080e9\n"}]}