News for hackers. Stuff that matters.
Re:The UTF-8-Everywhere Manifesto by adobriyan on Sunday April 29, 2012 @03:35PM (#3906809)
Unicode-compatible cat(1) would strip BOM from all but the first file.

Applying non-Unicode compatible utility to Unicode files of course doesn't work.

Re:The UTF-8-Everywhere Manifesto by 4ad on Sunday April 29, 2012 @03:43PM (#3906837)
Cat doesn't know and doesn't need to know what kind of input it gets, it's just for concatenatig files. Files themselves can be binary for all that matters (indeed, it was used very often to concatenate tape devices to be used by tar further down in the pipe).
Re:The UTF-8-Everywhere Manifesto by makecheck on Sunday April 29, 2012 @04:06PM (#3906904)
Agreed. The user of "cat" is responsible if they've created a stream that is invalid input to some other program. Unix philosophy is for programs to do (ideally) one simple thing well. If the contents of any one file cannot be used directly, then the idea would be to run some other filter program first (e.g. one that strips bytes from the beginning) prior to using "cat" and piping the results somewhere else.

In practice though some programs and protocols have text/binary distinction (e.g. FTP). It's not unreasonable to have a mode that hints when bytes are to be used as text. This is frequently done to handle different new-line styles for instance.

Re:The UTF-8-Everywhere Manifesto by ajross on Sunday April 29, 2012 @05:10PM (#3907136)
...and you think this is an argument in favor of including a BOM?
Re:The UTF-8-Everywhere Manifesto by makecheck on Sunday April 29, 2012 @06:49PM (#3907363)
I prefer to solve the problem in the right place.

Raw concatenation of bytes without encoding-awareness introduces the possibility that the bytes will combine in unexpected ways. The presence of something as obvious as a BOM makes it harder to make this mistake, at least during the transition phase to "UTF-8 everywhere".

What you really want in this situation is something that forces you to see the potential bug and introduce the correct translation and/or text-concatenation tools to fix it.

And yes, at some point in the future enough tools will be truly aware of UTF-8 that the BOM will not have a reason to exist. But right now it has some value.

Re:The UTF-8-Everywhere Manifesto by tripzilch on Monday April 30, 2012 @05:43AM (#3908597)
So, first you argue that UTF-8 without BOM might split glyphs at incorrect places, and then it's pointed out that UTF-8 with BOM concatenates files incorrectly, and somehow this is also an argument for using BOM?

I'm sorry but it's obvious both approaches have rather symmetrical opportunities to produce bugs. So in that case the best choice seems to be the simplest one. Which is the one without BOM.

Re:The UTF-8-Everywhere Manifesto by kragen on Sunday April 29, 2012 @08:33PM (#3907566)
Applying non-Unicode-compatible utilities to UTF-8 files works fine; that's why UTF-8 was invented. Adding a byte-order mark to a UTF-8 file is what causes non-Unicode-compatible utilities to stop working.