Re: [RFC/PATCH] git-gui: Use gitattribute "encoding" for file content display
- From
Steffen Prohaska <prohaska@zib.de>
- Date
- Jan 23, 2008, 08:41 UTC
- Message-ID
- <EFF72DA9-A717-44A1-9C5C-649D08BB7E96@zib.de>
- In-Reply-To
- <7v7ii1ozly.fsf@gitster.siamese.dyndns.org>
On Jan 23, 2008, at 6:55 AM, Junio C Hamano wrote:
Show 15 quoted lines
> "Shawn O. Pearce" <spearce@spearce.org> writes: > >> git-gui: Use gitattribute "encoding" for file content display >> >> Most folks using git-gui on internationalized files have complained >> that it doesn't recognize UTF-8 correctly. In the past we have just >> ignored the problem and showed the file contents as binary/US-ASCII, >> which is wrong no matter how you look at it. > > Hmmm. > > At least for now in 1.5.4, I'd prefer the way gitk shows UTF-8 > (if I recall correctly latin-1 or other legacy encoding, as long > as LANG/LC_* is given appropriately, as well) contents without > per-path configuration without introducing new attributes.
Shouldn't we first try harder to get things right without adding an attribute? Maybe we could continue a good tradition and look at the content of the first: we could first look for hints in the file about the encoding. XML and many text files contain such hints already to help editors. For example, Python source can explicitly contain the encoding [1]; and I guess there are many other examples. If we don't find a direct hint, we could have some magic auto-detection similar to what we do for autocrlf. As a fallback the user could specify a default encoding. But only as a last resort, I'd use explicit attributes.
[1] http://www.python.org/dev/peps/pep-0263/
Steffen