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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Krzysztof Mazur <krzysiek@xxxxxxxxxxxx> 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@xxxxxxxxxxxx>
> ---
>  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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]