在IE11中显示错误的字符实体-·呈现为& sum;-这真的是一个字符集问题吗? [英] Wrong character entities displaying in IE11 -- · rendering as ∑ -- is this really a charset issue?

查看:154
本文介绍了在IE11中显示错误的字符实体-·呈现为& sum;-这真的是一个字符集问题吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用HTML5设计了多个UI原型(最初在Chrome中进行了测试),并且在其他浏览器中进行测试时,注意到IE11正在用不同的字符替换常见的字符实体,例如& middot;和 在我正在测试的两个用户界面之一上进行测试.

I designed several UI prototypes (testing initially in Chrome) using HTML5, and while testing in other browsers, noticed that IE11 was substituting different characters for common character entities, like · and   on one of the two UI's I was testing.

两个原型都托管在同一台服务器上的不同文件夹中,所以我对我所做的指向IE10& amp;的研究感到有些困惑.IE11在HTML5中将HTTP优先于BOM优先;但是...如果服务器发送的标头声明了ISO-8859-1或Windows-1251,而覆盖了UTF-8字符集,那么我在两个原型上都不会看到相同的问题吗?我看不到其他字符有问题吗?

Both prototypes are hosted on the same server, in different folders, so I'm a bit baffled by the research I've done which points to IE10 & IE11 giving a higher precedence to HTTP over BOM in HTML5; but... if the server was sending out a header declaring ISO-8859-1 or windows-1251, overriding the UTF-8 charset, shouldn't I be seeing the same problem on both prototypes? Wouldn't I see problems with other characters?

真正困扰我的是,无论字符集如何,标记中的HTML字符实体都是相同的,对不对?IE如何错误地解释这一点?

The thing that is really bugging me is that, whatever the charset, the HTML character entities in the markup would be the same, right? How does IE manage to misinterpret that?

无论如何,我都尝试过:

In any case, I've tried:

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

以及:

 <meta charset="utf-8">

和:

<meta charset="ISO-8859-1">

仍然会†而不是不间断的空格,或∑而不是·

and still get † instead of non-breaking spaces, or ∑ instead of ·

我没有主机权限来更改.htaccess文件,尽管我会将该建议传递给我的主管.我只是不确定我是否对IE的行为方式有一个合理的解释.这个字符交换是由IE无法识别UTF-8引起的吗?

I don't have host access to change the .htaccess file, though I will pass that suggestion on to my supervisors. I'm just not sure I have a sound explanation for the way IE is behaving; is this character swapping truly caused by IE failing to recognize UTF-8?

如果该问题确实是由HTTP和BOM优先级引起的,我该如何解释此问题出现在同一主机的子文件夹A中,而不是出现在子文件夹B中?

How do I explain this issue appearing in subfolder A but not in subfolder B on the same host, if the problem does result from the HTTP vs BOM prioritization?

推荐答案

如果我未能清楚地陈述我的问题,我深表歉意.回顾一下,多年来我在标记中使用的字符实体在IE11中显示不正确.我寻找原因的原因导致我在堆栈溢出以及其他地方发现了几篇文章,这些文章表明问题可能是由于IE将HTTP头的优先级置于BOM之上的方式(与其他浏览器不同).

If I failed to present my question clearly, my apologies. To recap, character entities I've used in my markup for years were displaying incorrectly in IE11. My search for a cause led me to several posts on stack overflow and elsewhere that suggested the problem might be due to the way IE puts priority on the HTTP header over the BOM (unlike other browsers).

请参阅: UTF-8编码不能在Internet Explorer上正常工作,但可以与Mozilla Firefox完美配合(它还建议: IE在呈现HTML页面时使用了错误的字符集).

See: UTF-8 encoding does not work properly with Internet Explorer but works perfectly with Mozilla Firefox (which also recommends: IE uses the wrong character set when it renders an HTML page).

但是,在检查一下要确切地应用于页面的编码时,它一直说UTF-8.因此,我提出了这个问题,以找出是否还有另一个已知原因.我没有得到答案,但是我自己偶然发现了.在某种程度上,答案是隐含在我链接到该帖子的作者对他自己的问题的答案中的.我当时根本没看到它.

However, on checking to see exactly what encoding was being applied to the page, it kept saying UTF-8. So, I put up this question to find out if there was another known cause. I did not get an answer, but I did stumble across on on my own. In a way, the answer is implicit in the answer the author of the post I linked to gave to his own question. I simply did not see it at the time.

简单地说,我的缺陷"原型没有声明unicode字体.我以为我是使用相同的基本CSS来启动两个原型的,但是……是的,这些事情发生了.我没有检查的一件事,因为我非常有信心它死记硬背.在这个(和相关)主题的各种文章中,我确实提到了HTML5中对unicode字体的需求,但是让我强调一下:

Put simply, my "defective" prototype did not have a unicode font declared. I thought I started both prototypes with the same basic css, but... yeah, these things happen. The one thing I didn't check, because I was so confident it did it by rote. I did catch references to the need for unicode fonts in HTML5 in various posts on this (and related) topics, but let me emphasize:

确保在HTML5中将Unicode字体与UTF-8一起使用

我假设除IE之外的其他浏览器在其默认字体系列的字体堆栈中都具有unicode版本.

I'm assuming that browsers other than IE have unicode versions in the font stacks of their default font-families.

这篇关于在IE11中显示错误的字符实体-&middot;呈现为&amp; sum;-这真的是一个字符集问题吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆