Re: [PATCH 1/2] utf8: refactor code to decide fallback encoding

2016-09-27 Thread Junio C Hamano
Jeff King writes: > But once we introduce other fallbacks, then "utf8 -> latin1" may become > "UTF-8 -> iso8859-1". A system that knows only "utf8" and "iso8859-1" > _could_ work if we turned the knobs individually, but won't if we turn > them both at once. Worse, a system that

Re: [PATCH 1/2] utf8: refactor code to decide fallback encoding

2016-09-26 Thread Jeff King
On Mon, Sep 26, 2016 at 06:22:10PM -0700, Junio C Hamano wrote: > @@ -501,17 +516,9 @@ char *reencode_string_len(const char *in, int insz, > > conv = iconv_open(out_encoding, in_encoding); > if (conv == (iconv_t) -1) { > - /* > - * Some platforms do not have

[PATCH 1/2] utf8: refactor code to decide fallback encoding

2016-09-26 Thread Junio C Hamano
The codepath we use to call iconv_open() has a provision to use a fallback encoding when it fails, hoping that "UTF-8" being spelled differently could be the reason why the library function did not like the encoding names we gave it. Essentially, we turn what we have observed to be used as