开发者

Why does internet explorer 9 show weird characters on UTF8 and whitespace content?

I'm开发者_StackOverflow currently working on a customer website and stumbled on this strange error, given the HTML:

<p>&nbsp;</p>
<p>
    <span class="indentLeft">
        REDACTED&nbsp;A/S&nbsp;har hovedsæde i Århus (foto).
    </span>
</p>

Internet Explorer 9 will show the following:

Why does internet explorer 9 show weird characters on UTF8 and whitespace content?

Now, to begin with I thought it was an encoding issue, except IE7,IE8, firefox, chrome and safari shows it correctly.

So my question really is... is there something new in Internet Explorer 9 that I'm not aware of, some header of some kind that makes it display HTML entities, or is it my server side encoding?

I tried forcibly changing encodings in IE9 with no luck so I'm back to square one.


What is the character encoding being used by the file that stores the HTML? Determine the encoding, then set that encoding to be used by whatever parses the document. For example, if your document is stored with the UTF-8 encoding:

<head>
    <meta charset="UTF-8">
</head>

I would also try changing the font, just to make sure it's not a glyph issue, but I suspect encoding as well.


I solved the issue by opening the file (theme-ui.php) in visual studio and saving it as "unicode without signature".


I have a similar problem in IE9 where utf-8 delivered by xmlHTTPRequest becomes interpreted as ISO 8859-1 despite the fact that the implementing document contains:

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

.. and that XMLHttpRequest.getResponseHeader('Content-Type') returns: text/html; charset=UTF-8

Changing to a non TTF font doesn't help

This happens if the implementing document contains:

<meta http-equiv="X-UA-Compatible" content="IE=8">

The problem goes away if the line is removed or is changed to:

<meta http-equiv="X-UA-Compatible" content="IE=7">


I had the same problem, tried the both Nathan and Terje's solutions without success.

I finally resolved the issue by changing encoding in Notepad++ from 'Encode in UTF-8 without BOM' to 'Encode in UTF-8'

Hope that helps.


In my case the problem was about the font! The Arabic font I was using wasn't compatible with IE but working well with chrome. I changed the font to compatible one!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜