rsturim rsturim - 1 year ago 285
CSS Question

How to fix "Byte-Order Mark found in UTF-8 File" validation warning

I've got an xhtml page validating under xhtml strict doctype -- but, I getting this warning which I trying to understand -- and correct.

Just, how do I locate this errant "Byte-Order Mark". I'm editing my file using Visual Studio--not sure if that helps.

Warning Byte-Order Mark found in UTF-8 File.

The Unicode Byte-Order Mark (BOM) in UTF-8 encoded files is known to cause problems for some text editors and older browsers. You may want to consider avoiding its use until it is better supported.

Answer Source

The location part of your question is easy: The byte-order mark (BOM) will be at the very beginning of the file.

When editing the file, go to File | Advanced Save Options... and you should find an "Encoding" drop-down (along with a "Line endings" drop-down). It's probably set to use "Unicode (UTF-8 with signature) - Codepage 65001". If you scroll down a fair bit, you can find "Unicode (UTF-8 without signature) - Codepage 65001". That should do it (if you want to). Some systems may be confused by a BOM on a UTF-8 file, as the warning indicates.

See also this note in the Unicode site's FAQ about the BOM and UTF-8 files. It has no function other than to call out that the file is, in fact, UTF-8. In particular, it has no effect on the byte order (the main reason we have BOMs), because the byte order of UTF-8 is fixed.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download