HTML and CSS Reference
See, we're getting
this warning message
that the validator can't
find a character encoding.
Frank: The character encoding tells the browser what kind of
characters are being used in the page. For instance, pages can be
written using encodings for English, Chinese, Arabic, and lots of other
types of characters.
Jim: What's so hard about figuring out how to display a character? If
there's an “a” in the file, then the browser should display an “a”. Right?
Frank: Well, what if you're using Chinese in your pages? It's an
entirely different “alphabet” and it has a heck of a lot more than 26
Jim: Oh. Good point…but shouldn't the browser be able to tell the
difference? Those other languages look nothing like English.
Frank: No, the browser is just reading data. It can try to guess what
kind of character encoding to use, but what if it's wrong? This can lead
not only to pages being displayed wrong, but also potential exploits
from hackers. The character encoding takes the guesswork out of it.
Jim: We've had the site up for a long time. Why is this an issue now?
Frank: Because the validator is saying “Hey, if I'm going to validate
your page, you'd better tell me up front what characters you're going
to use!” And think about it, we'd want to do that for the browsers out
there anyway. Don't stress, we just need to add one more line to our
HTML, called a <meta> tag. I should have thought of this sooner.
Jim: Got any other surprises for us? I really thought our web page
would validate after we put the document type definition in our file…
Frank: I sure hope there are no more surprises! Let's get the <meta>
tag in there and find out.