tags:

views:

101

answers:

3

Code as follows:

<meta http-equiv="Content-type" content="text/html; charset=utf8" />

But when I browse the page using IE, it still uses its default charset, which is not utf8.

And the page becomes normal only after I set the character set to utf8 manually.

Why the HTML failed to inform browser of its character set?

It's on local file system,I browse it by file:///F:/jobs.html

+1  A: 

Probably because the server is specifying an encoding itself. Real HTTP headers take priority.

See http://www.w3.org/International/O-HTTP-charset

David Dorward
Can be fixed by either modifying HTTP server configuration (I think AddDefaultCharset directive for apache), or if you're using a scripting language then you can tell it to output the apropriate Content-Type header.
Todd Owen
+1  A: 

There’s an order in that the actual character encoding is choosen:

To sum up, conforming user agents must observe the following priorities when determining a document's character encoding (from highest priority to lowest):

  1. An HTTP "charset" parameter in a "Content-Type" field.
  2. A META declaration with "http-equiv" set to "Content-Type" and a value set for "charset".
  3. The charset attribute set on an element that designates an external resource.

So your META declaration may not be considered if there’s already a charset declaration in the Content-Type HTTP header field.

Gumbo
A: 

It should be utf-8 not utf8.

David Dorward