Re: [PATCH 1/2] utf8: refactor code to decide fallback encoding
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 27, 2016, 15:33 UTC
- Message-ID
- <xmqqvaxhqrwd.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20160927055202.4ucddki3xkns45om@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 10 quoted lines
> 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 knows only "UTF-8" and "latin1" > works now, but would break with your patches. > > I'm not convinced it's worth worrying about, though. The existence of > such a system is theoretical at this point. I'm not even sure how common > the "know about utf8 but not UTF-8" thing is, or if we were merely being > overly cautious.
Yeah, I did consider having to try the permutations until it works, but suspecting that somebody takes "utf8" without taking "UTF-8" is to pretty much invalidate the basic premise of the existing code, i.e. spelling it as "UTF-8" is the most likely to work anywhere as long as UTF-8 is supported, so I stopped worrying about it at that point.
I'd actually welcome a more generic suggestions we can put in our documentation so that we can _lose_ the fallback entirely (e.g. "if your contributor spelled 'utf8' and your system, which does take 'UTF-8', does not like it, then here is what you can do to your /etc/locale.alias").