From: Krzysztof Mazur <krzysiek@podlesie.net>
To: git@vger.kernel.org
Cc: Krzysztof Mazur <krzysiek@podlesie.net>
Subject: [PATCH 2/2] git-send-email: use locale encoding for compose
Date: Thu, 4 Oct 2012 00:05:31 +0200 [thread overview]
Message-ID: <1349301931-11912-2-git-send-email-krzysiek@podlesie.net> (raw)
In-Reply-To: <1349301931-11912-1-git-send-email-krzysiek@podlesie.net>
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 <krzysiek@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
next prev parent reply other threads:[~2012-10-04 21:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-03 22:05 [PATCH 1/2] git-send-email: introduce compose-encoding Krzysztof Mazur
2012-10-03 22:05 ` Krzysztof Mazur [this message]
2012-10-09 21:34 ` [PATCH 2/2] git-send-email: use locale encoding for compose Junio C Hamano
2012-10-09 23:02 ` Krzysztof Mazur
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1349301931-11912-2-git-send-email-krzysiek@podlesie.net \
--to=krzysiek@podlesie.net \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).