git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Git Attribute: File Text Encoding {WAS: Re: [RFC] Print diffs of UTF-16 to console / patches to email as UTF-8...?}

From
Jakub Narebski <jnareb@gmail.com>
Date
Oct 22, 2010, 21:49 UTC
Message-ID
<m3sjzxkifz.fsf@localhost.localdomain>
In-Reply-To
<1287778695.819.17.camel@drew-northup.unet.maine.edu>
Drew Northup <drew.northup@maine.edu> writes:
Show 23 quoted lines
> On Fri, 2010-10-22 at 14:53 -0500, Jonathan Nieder wrote:
> > Joshua Juran wrote:
> 
> > >                                                      But a more
> > > complete and robust solution would be to store the encoding
> > > somewhere, possibly in the blob itself, or in the tree storing the
> > > filename.
> > 
> > How about Jakub's idea of keeping it in .gitattributes (or some
> > similarly visible key/value store)?  Two reasons:
> > 
> >  1. When asked to declare encoding, half the time people will be
> >     wrong.  So it seems worthwhile to make the declared encoding
> >     visible enough to fix.
> > 
> >  2. Two ASCII files identical except that one is declared as
> >     latin1 and the other utf8 should be considered identical.
> > 
> > Thanks for some food for thought.
> 
> I think that's a fine place to start. Shall I start a branch for it when
> I get home (where the code I'm working on is located)? It would be good
> practice if nothing else...

Just for clarification: Git supports and uses `encoding` gitattribute, but it is used currently _only_ bu git-gui (by converting from `encoding` gitattribute to `git.encoding` given by config).

The places that are missing:
1. A way to check attribute of a file in given tree.  Currently 
   git-check-attr checks for .gitattributes _only_ from working
   area (in addition to unversioned .git/info/attributes, and perhaps
   in the future core.attributesFile a la core.excludesFile).
2. A consensus where conversion should take place: at which level
   in stack, for what output destination, etc.
3. Support for i18n.blobOutputEncoding, which would convert (unless
   overriden) e.g. in 'git show <blob>', and perhaps also in diff.
-- 
Jakub Narebski
Poland
ShadeHawk on #git
Previous: Drew Northup
Message 15 of 15 in “[RFC] Print diffs of UTF-16 to console / patches to email as UTF-8...?”
  1. Drew NorthupOct 22, 2010
  2. Jonathan NiederOct 22, 2010
  3. Drew NorthupOct 22, 2010
  4. Jonathan NiederOct 22, 2010
  5. Drew NorthupOct 22, 2010
  6. Jonathan NiederOct 22, 2010
  7. Jakub NarebskiOct 22, 2010
  8. Jakub NarebskiOct 22, 2010
  9. Drew NorthupOct 22, 2010
  10. Jakub NarebskiOct 22, 2010
  11. Joshua JuranOct 22, 2010
  12. Jeff KingOct 22, 2010
  13. Jonathan NiederOct 22, 2010
  14. Git Attribute: File Text Encoding {WAS: Re: [RFC] Print diffs of UTF-16 to console / patches to email as UTF-8...?}Drew Northup, Oct 22, 2010
  15. Jakub NarebskiOct 22, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.