3 ms·
In UTF-8 a BOM can be placed to support round tripping the information with UTF-16.
by the_mitsuhiko 10y ago
In UTF-8 a BOM can be placed to support round tripping the information with UTF-16.
- umanwizard 10y agoSo what order do you put the BOM in? Does it not even matter?
- Avernar 10y agoThe 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 :)