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

5

6

I'm 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:

IE9 Snippet showing whitespace characters

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.

Costar answered 4/5, 2011 at 10:30 Comment(0)
O
12

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.

Obloquy answered 4/5, 2011 at 10:40 Comment(3)
It did indeed appear to be a font issue, it would appear Helvetica is broken on our dev machines... in Internet Explorer 9 only O_oCostar
I did a little bit more digging. I'm guessing the font was a TrueType Font. The mapping of Unicode values to TTF values (A0 for non-breaking space in Unicode and dagger in TTF) matched exactly.Obloquy
FWIW, I just ran into this and just adding that meta tag fixed things... (already had a correct DOCTYPE, content-type header AND content-type meta tag)Geez
C
3

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">
Calibre answered 18/7, 2011 at 8:54 Comment(1)
Is this a question or an answer?Orenorenburg
M
3

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

Marrero answered 5/8, 2012 at 10:22 Comment(0)
W
2

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.

Whereabouts answered 27/4, 2012 at 16:43 Comment(0)
L
0

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!

Loma answered 31/10, 2015 at 2:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.