2007/7/10, Timo Kreuzer timo.kreuzer@web.de:
You see the problem when opening it with a hexeditor: the file begins with EF BB BF when you remove it and reopen the file with windows notepad, it will be put there again.
Don't use windows notepad to edit rc files!
The UTF-8 representation of the BOM (Byte Order Mark) is the byte sequence EF BB BF, which appears as the ISO-8859-1 characters "" in most text editors and web browsers not prepared to handle UTF-8.
While UTF-8 does not have byte order issues (in contrary to UTF-16), a BOM encoded in UTF-8 may be used to mark text as UTF-8. It only identifies a file as UTF-8 and does not state anything about byte order.
Most Win32 software (inclusive notepad.exe) are aware of that leading characters and interprate it in the "correct" way. In fact these chars help the software to "guess" the right character encoding. If no such leading chars are there, the software has to check the first few chars and guess the hopefully right one. And latest versions of the Windows notepad.exe do a good job at detecting the variations.
Our problem is that gcc and overall most unix software simple don't know (or care) to handle that chars.
"[...] gcc reports stray characters at the beginning of a source file [...]" as the related Wikipedia page mentions.
Further information:
* Raymond Chen's blog entry about notepad.exe & BOM: http://blogs.msdn.com/oldnewthing/archive/2004/03/24/95235.aspx
* http://en.wikipedia.org/wiki/Byte_Order_Mark
Klemens