为什么 Internet Explorer 9 在 UTF8 和空白内容上显示奇怪的字符?
我目前正在开发一个客户网站,并偶然发现了这个奇怪的错误,考虑到 HTML:
<p> </p>
<p>
<span class="indentLeft">
REDACTED A/S har hovedsæde i Århus (foto).
</span>
</p>
Internet Explorer 9 将显示以下内容:
现在,首先我认为这是一个编码问题,除了 IE7、IE8、firefox、chrome 和 safari 可以正确显示它。
所以我的问题确实是... Internet Explorer 9 中是否有一些我不知道的新内容,某种使其显示 HTML 实体的标头,或者是我的服务器端编码?
我尝试在 IE9 中强制更改编码,但没有成功,所以我又回到了原点。
I'm currently working on a customer website and stumbled on this strange error, given the HTML:
<p> </p>
<p>
<span class="indentLeft">
REDACTED A/S har hovedsæde i Århus (foto).
</span>
</p>
Internet Explorer 9 will show the following:
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
存储 HTML 的文件使用的字符编码是什么?确定编码,然后将该编码设置为解析文档时使用的编码。例如,如果您的文档使用 UTF-8 编码存储:
我也会尝试更改字体,只是为了确保它不是字形问题,但我也怀疑编码。
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:
I would also try changing the font, just to make sure it's not a glyph issue, but I suspect encoding as well.
我通过在 Visual Studio 中打开文件(theme-ui.php)并将其保存为“没有签名的unicode”解决了这个问题。
I solved the issue by opening the file (theme-ui.php) in visual studio and saving it as "unicode without signature".
我在 IE9 中遇到类似的问题,其中 xmlHTTPRequest 传递的 utf-8 被解释为 ISO 8859-1,尽管实现文档包含:
.. 以及
XMLHttpRequest.getResponseHeader('Content-Type')
返回:text/html; charset=UTF-8
更改为非 TTF 字体没有帮助
如果实施文档包含以下内容,则会发生这种情况:
如果删除该行或将其更改为: 则问题就会消失:
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:
.. 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:
The problem goes away if the line is removed or is changed to:
我遇到了同样的问题,尝试了 Nathan 和 Terje 的解决方案,但没有成功。
我最终通过将 Notepad++ 中的编码从“不带 BOM 的 UTF-8 编码”更改为“UTF-8 编码”解决了这个问题
希望有帮助。
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.
就我而言,问题出在字体上!
我使用的阿拉伯字体与 IE 不兼容,但在 Chrome 上运行良好。
我把字体换成了兼容的字体!
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!