Jump to content

Unicode Byte-Order Mark in UTF-8 encoded files


real_illusions
 Share

Recommended Posts

I am trying to validate a webpage, however, something i've never seen before has cropepd up.The w3c validator is saying the following"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."The top of the page is<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>I have removed the keywords, stylesheet and description (as they're not important in this).Anyway, I use the same charst-utf-8 on my site, and that validates fine, no warnings about the BOM. I cant made head or tail out of the wiki pages about the BOM, and i cant seem to find much info on why this error occurs. Anyone got any ideas?:)

Link to comment
Share on other sites

It's not a coding issue. It's an encoding issue. Notepad places a BOM in the files you save in it as UTF-8. Other editors have an option on whether to place it or not.I think the idea behind BOM is to render the characters "" in user agents that are not using UTF-8, but are instead using another ASCII encoding. If you see those characters in Firefox, Opera, or another browser, it means the server is not serving the page as UTF-8, and so you need to make adjustments.The validator is warning you about this, because if this character appears, it could totally mess up your layout, hence you're probably not expecting your layout to be working with a "" at the top.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...