Blowing Away The BOM
I recently inherited a web site that was littered with BOMs. A BOM is a byte-order mark which is the Unicode codepoint U+FEFF, corresponding to the Unicode character 'ZERO WIDTH NON-BREAKING SPACE' (ZWNBSP). To dumb it down a shade, every instance of a BOM displayed like ï»¿ in the web browser. Occasionally IE would suppress these funky characters, but not always, and Firefox was very unforgiving. ï»¿ was everywhere.
It was fun trying to figure out where these guys were and how to prevent them from reappearing. It seems there's a bug when you combine PHP files with the Apache web server and crappy Microsoft text editors. That told me how to prevent the BOM, but how would I delete a character that I couldn't see in my editor?
The solution is a hex editor. In a hex editor, you can see the BOM and therefore delete the BOM. I downloaded this Freeware Hex Editor XVI32, weeded out the nasty buggers, over wrote the BOM-infested PHP files on the server and banned text editors like Microsoft's Expression Web.
The BOMs are gone. My work here is done.
No comments? C'mon, we can do better... Leave a comment above and let's start this conversation!