Re: [PATCH ] t4210-log-i18n: spell encoding name "UTF-8" correctly

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

 



Am 2/25/2013 21:31, schrieb Jeff King:
> Subject: [PATCH] utf8: accept alternate spellings of UTF-8
> ...
> JSixt, can you double-check that this passes t4210 for you?

Yes, t4210 and all other *i18n* and *log* tests pass with this patch.

Thanks,
-- Hannes

> 
>  utf8.c | 20 ++++++++++++++++++--
>  1 file changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/utf8.c b/utf8.c
> index 1087870..8f6e84b 100644
> --- a/utf8.c
> +++ b/utf8.c
> @@ -507,9 +507,25 @@ char *reencode_string(const char *in, const char *out_encoding, const char *in_e
>  
>  	if (!in_encoding)
>  		return NULL;
> +
>  	conv = iconv_open(out_encoding, in_encoding);
> -	if (conv == (iconv_t) -1)
> -		return NULL;
> +	if (conv == (iconv_t) -1) {
> +		/*
> +		 * Some platforms do not have the variously spelled variants of
> +		 * UTF-8, so let's fall back to trying the most official
> +		 * spelling. We do so only as a fallback in case the platform
> +		 * does understand the user's spelling, but not our official
> +		 * one.
> +		 */
> +		if (is_encoding_utf8(in_encoding))
> +			in_encoding = "UTF-8";
> +		if (is_encoding_utf8(out_encoding))
> +			out_encoding = "UTF-8";
> +		conv = iconv_open(out_encoding, in_encoding);
> +		if (conv == (iconv_t) -1)
> +			return NULL;
> +	}
> +
>  	out = reencode_string_iconv(in, strlen(in), conv);
>  	iconv_close(conv);
>  	return out;
--
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]