Re: [PATCH ] t4210-log-i18n: spell encoding name "UTF-8" correctly
- From
Jeff King <peff@peff.net>
- Date
- Feb 25, 2013, 20:36 UTC
- Message-ID
- <20130225203652.GB15932@sigill.intra.peff.net>
- In-Reply-To
- <512BB377.2010403@web.de>
On Mon, Feb 25, 2013 at 07:54:47PM +0100, Torsten Bögershausen wrote:
> (beside that I couldn't find t4210 somewhere),
It's newly added in 04deccd.
Show 12 quoted lines
> diff --git a/utf8.c b/utf8.c
> index a4ee665..e9850d0 100644
> --- a/utf8.c
> +++ b/utf8.c
> @@ -487,6 +487,10 @@ 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 && errno == EINVAL) {
> + conv = iconv_open(is_encoding_utf8(out_encoding) ? "UTF-8" : out_encoding,
> + is_encoding_utf8(in_encoding) ? "UTF-8" : in_encoding);
> + }Yeah, I think this is pretty close to the patch I just sent. You do the fallback, which I think is sane to prevent any possible regression (for "type 3" systems, as I called them in my commit). I don't know if it is worth checking errno; we should get the same failure either way, and I'd worry slightly about some odd iconv implementation does not use EINVAL.
And of course, I like my indentation and commit message better. :)
-Peff