git-send-email: use compose-encoding for Subject
[gitweb.git] / git-send-email.perl
index 107e814b67239030f35ad910a02ed8828bc4671c..adcb4e397b76187a3364456f1511e19a1cb742fb 100755 (executable)
@@ -636,15 +636,15 @@ sub get_patch_subject {
        my $need_8bit_cte = file_has_nonascii($compose_filename);
        my $in_body = 0;
        my $summary_empty = 1;
+       if (!defined $compose_encoding) {
+               $compose_encoding = "UTF-8";
+       }
        while(<$c>) {
                next if m/^GIT:/;
                if ($in_body) {
                        $summary_empty = 0 unless (/^\n$/);
                } elsif (/^\n$/) {
                        $in_body = 1;
-                       if (!defined $compose_encoding) {
-                               $compose_encoding = "UTF-8";
-                       }
                        if ($need_8bit_cte) {
                                print $c2 "MIME-Version: 1.0\n",
                                         "Content-Type: text/plain; ",
@@ -658,7 +658,7 @@ sub get_patch_subject {
                        my $subject = $initial_subject;
                        $_ = "Subject: " .
                                ($subject =~ /[^[:ascii:]]/ ?
-                                quote_rfc2047($subject) :
+                                quote_rfc2047($subject, $compose_encoding) :
                                 $subject) .
                                "\n";
                } elsif (/^In-Reply-To:\s*(.+)\s*$/i) {