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

utf8 BOM

From
Dmitry Potapov <dpotapov@gmail.com>
Date
May 14, 2010, 10:16 UTC
Message-ID
<20100514101648.GB6212@dpotapov.dyndns.org>
In-Reply-To
<014C9B00-800C-465D-A0B9-98BEEB7D7A96@gmail.com>
On Thu, May 13, 2010 at 01:47:45PM +0200, Eyvind Bernhardsen wrote:
Show 6 quoted lines
> 
> I just did a quick test with a plain text file; it was detected as
> text both with and without a utf8 BOM.  Looking at the code,
> characters >= 128 are considered printable so the BOM shouldn't make
> any difference at all.  Do you have an example utf8 text file that is
> misdetected as binary?

Though UTF-8 BOM does not present any problem for automatic text detector, it is another piece from Microsoft that creates some interoperability issues when you work with non-ASCII text files. In short:

1. Microsoft editors and tools like to add utf8 BOM to files, and
   you cannot turn this behavior off.
2. Many tools (such as Microsoft compiler) incapable to recognize
   UTF-8 files without BOM, so they screw up all non-ASCII chars.

#1 is a problem, because it creates changes consisting solely of adding utf8 BOM. Moreover, users of non-Windows platforms are not exactly thrilled with having utf8 BOM at the beginning of every text file.

Probably, ability of automatic add utf8 BOM on Windows to text files (which are marked as "unicode") can be helpful, but it is just a part of the problem of how to deal with text files in "legacy" encoding, which are still widely used on Windows.

Dmitry
Previous: Robert BuckNext: Eyvind Bernhardsen
Message 11 of 27 in “End-of-line normalization, redesigned”
  1. 0/5 End-of-line normalization, redesignedEyvind Bernhardsen, May 12, 2010
  2. 1/5 autocrlf: Make it work also for un-normalized repositoriesEyvind Bernhardsen, May 12, 2010
  3. 2/5 Add tests for per-repository eol normalizationEyvind Bernhardsen, May 12, 2010
  4. 3/5 Add per-repository eol normalizationEyvind Bernhardsen, May 12, 2010
  5. 4/5 Rename "crlf" attribute as "eolconv"Eyvind Bernhardsen, May 12, 2010
  6. Linus TorvaldsMay 13, 2010
  7. Robert BuckMay 13, 2010
  8. Robert BuckMay 13, 2010
  9. Eyvind BernhardsenMay 13, 2010
  10. Robert BuckMay 13, 2010
  11. utf8 BOMDmitry Potapov, May 14, 2010
  12. Eyvind BernhardsenMay 15, 2010
  13. Dmitry PotapovMay 16, 2010
  14. Eyvind BernhardsenMay 16, 2010
  15. TaitMay 16, 2010
  16. Dmitry PotapovMay 16, 2010
  17. Eyvind BernhardsenMay 13, 2010
  18. Linus TorvaldsMay 13, 2010
  19. Robert BuckMay 14, 2010
  20. Jonathan NiederMay 14, 2010
  21. Eyvind BernhardsenMay 14, 2010
  22. Eyvind BernhardsenMay 14, 2010
  23. Eyvind BernhardsenMay 14, 2010
  24. Linus TorvaldsMay 14, 2010
  25. Add "core.eol" variable to control end-of-line conversionEyvind Bernhardsen, May 15, 2010
  26. Robert BuckMay 16, 2010
  27. 5/5 Rename "core.autocrlf" config variable as "core.eolconv"Eyvind Bernhardsen, May 12, 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.