BOM (Byte Order Mark) Explained: What That Hidden Character Costs You
The BOM is a zero-width, invisible character that causes broken CSV imports, JSON parse errors, and HTTP header issues. Learn what it is and how to remove it.
Published:
Tags: encoding, unicode, developer-tools
BOM (Byte Order Mark) Explained: What That Hidden Character Costs You The Byte Order Mark is a zero-width, invisible character that lives at the start of some text files. In the right context, it's a useful encoding signal. In the wrong context, it breaks PHP scripts, corrupts CSV imports, and causes mysterious "unexpected character at position 0" errors. This article explains what the BOM is, when it's necessary, and when it will ruin your day. |---|---| | UTF-8 BOM | | | | UTF-16 Big Endian | | | | UTF-16 Little Endian | | | | UTF-32 Big Endian | | | | UTF-32 Little Endian | | | Why UTF-16 and UTF-32 Need a BOM UTF-16 stores characters as 2-byte code units. The letter 'A' (U+0041) in UTF-16 big-endian is . In UTF-16 little-endian, the bytes are reversed: . When you receive a UTF-16…
All articles · theproductguy.in