git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] git-send-email: use locale encoding for compose

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 9, 2012, 21:34 UTC
Message-ID
<7vehl7e3cs.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1349301931-11912-2-git-send-email-krzysiek@podlesie.net>
Krzysztof Mazur <krzysiek@podlesie.net> writes:
Show 38 quoted lines
> 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.
Previous: Krzysztof MazurNext: Krzysztof Mazur
Message 3 of 4 in “git-send-email: introduce compose-encoding”
  1. 1/2 git-send-email: introduce compose-encodingKrzysztof Mazur, Oct 3, 2012
  2. 2/2 git-send-email: use locale encoding for composeKrzysztof Mazur, Oct 3, 2012
  3. Junio C HamanoOct 9, 2012
  4. Krzysztof MazurOct 9, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.