4 ms·
The unicode BOM is code point U+FEFF. The process of encoding it determines the order. Encoded to UTF-8 it becomes EF BB BF. Encoding to UTF-16 big endian it
by Avernar 10y ago
The unicode BOM is code point U+FEFF. The process of encoding it determines the order.
Encoded to UTF-8 it becomes EF BB BF. Encoding to UTF-16 big endian it will become FE FF. Encoding it to UTF-16 little endian it becomes FF FE.
Converting it back from UTF-8 always gives you U+FEFF since UTF-8 doesn't care about endianess. Converting it back from UTF-16 using the correct endianess gives you U+FEFF. Converting it using the wrong endianess gives you U+FFFE which is defined by unicode as a "non character" that should never appear in text.
- umanwizard 10y agoMakes sense, thanks :)