The introduction email (--compose option) use UTF-8 as default encoding.
The current locale encoding is much better default value.

Signed-off-by: Krzysztof Mazur <krzys...@podlesie.net>
---
 git-send-email.perl | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 107e814..139bb35 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -590,6 +590,16 @@ sub get_patch_subject {
        die "No subject line in $fn ?";
 }
 
+sub locale_encoding {
+       my $encoding = "UTF-8";
+       eval {
+               require I18N::Langinfo;
+               I18N::Langinfo->import(qw(langinfo CODESET));
+               $encoding = langinfo(CODESET());
+       };
+       return $encoding;
+}
+
 if ($compose) {
        # Note that this does not need to be secure, but we will make a small
        # effort to have it be unique
@@ -643,7 +653,7 @@ EOT
                } elsif (/^\n$/) {
                        $in_body = 1;
                        if (!defined $compose_encoding) {
-                               $compose_encoding = "UTF-8";
+                               $compose_encoding = locale_encoding();
                        }
                        if ($need_8bit_cte) {
                                print $c2 "MIME-Version: 1.0\n",
-- 
1.7.12.2.2.g1c3c581

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to