简体   繁体   中英

Does IE8 ignore Content-Type's charset in header?

I have a very simple PHP file. I had set the charset using PHP's header() function as below...

header('Content-Type: text/html; charset=utf8');

Nothing was overwriting it, as I inspected the headers and it was coming through fine.

I am using a Unicode arrow ( ) on my page. It is directly on the page, and not processed by any string manipulation functions.

It worked fine on Firefox and Safari, but in IE8 it came out as a mess (2 weird glyphs).

After some frustration, I added this to my head as well...

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

...and it fixed it.

What is the issue? Does IE8 ignore the charset in the header? Doesn't the http-equiv mean that it should be treated exactly like a normal header?

Your HTTP header contains utf8 , but your meta tag contains utf-8 . I'm fairly sure the latter is the correct name. Check if putting utf-8 in the HTTP header helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM