I am currently reading Dive into HTML5 and I’ve got a question regarding the character encoding part.
The book starts by saying that the reason there exists a <meta> element used to set the character encoding (like <meta http-equiv="Content-Type" content="text/html; charset=utf-8">)is that not everyone has access to web servers, and hence they are not able to set the HTTP Content-Type header, which would be the correct way to do it. Ok, that makes a lot of sense.
But then he goes on and says that
The HTTP header is the preferred method, and it overrides the
<meta>tag if present.
Now, that doesn’t make sense. Wasn’t the <meta> tag supposed to allow you to override server behavior, in cases when you don’t have access to it?
The
http-equivmetas allow you to provide a value if the server is not sending it. They are not intended to be replacements for server side configuration, in fact it was always intended the server would parse the (static) file and send the appropriate header. Have a look at this description in the HTML 3.2 spec (Jan 1997):