git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Krzysztof Mazur <krzysiek@podlesie.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] git-send-email: use locale encoding for compose
Date: Tue, 09 Oct 2012 14:34:59 -0700	[thread overview]
Message-ID: <7vehl7e3cs.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1349301931-11912-2-git-send-email-krzysiek@podlesie.net> (Krzysztof Mazur's message of "Thu, 4 Oct 2012 00:05:31 +0200")

Krzysztof Mazur <krzysiek@podlesie.net> writes:

> 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",

These two patches make sense in general, but t9001.62 (--compose
adds MIME for utf8 body) seems to be broken by it.  I didn't check
to see if the code is broken, or the test has expecting a wrong
behaviour.  If the latter, the test needs to be updated to match the
improved new world order.

Thanks.

  reply	other threads:[~2012-10-09 21:35 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 ` [PATCH 2/2] git-send-email: use locale encoding for compose Krzysztof Mazur
2012-10-09 21:34   ` Junio C Hamano [this message]
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=7vehl7e3cs.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=krzysiek@podlesie.net \
    /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).