显示此行为的 URL 位于此处:
http://culturewithinaculture.org/introduction.php
http://culturewithinaculture.org/about.php
该网站尚未正式启动。但我的问题是在右侧,日语副本。我将文档类型设置为 UTF-8,这是我认为应该的。在 Firefox 和 Safari 上我完全没有问题...显示得很好。然而在 IE 8 中,它是方框和非法字符。有趣的是,如果您单击“兼容模式”按钮,它会刷新页面,一切都很好。然而,这也产生了好坏参半的结果,我的一个 friend 在装有 IE 8 的 XP 机器上尝试过,兼容模式不起作用(仍然有无法识别的字符的方框)。
我希望它能够跨浏览器,并且我不想强制 IE 用户单击“兼容模式”按钮或类似的东西。我知道我可以让日语复制一个大图像,但如果可能的话,我希望可以选择文本和 HTML。
你们中有人遇到过这个问题吗?是否有一些特殊的 IE 专用 CSS 或 jQuery 魔法我可以用来强制正确的文本显示?也许是字体技巧?
非常感谢所有帮助!
最佳答案
这是您的响应 header :
Date: Thu, 08 Jul 2010 22:52:12 GMT Server: Apache/2.0.54 X-Powered-By: PHP/4.4.8 Vary: Accept-Encoding Content-Encoding: gzip Content-Length: 5319 Keep-Alive: timeout=5, max=88 Connection: Keep-Alive Content-Type: text/html
Note that the Content-Type
header is missing the charset
attribute and the webbrowser is thus forced to use platform default encoding which is often ISO-8859-1. FireFox is actually smart enough to autodetect the correct encoding and apply it instead (you can check it by View > Character Encoding).
Since those pages seem to be PHP generated, best what you can do is to add the following to the top of your PHP pages (or header-include, if any), before any character is been emitted to the response body:
header('Content-Type: text/html; charset=UTF-8');
另请参阅:
关于jquery - 日语字符在 IE 8 中无法正确显示...不确定早期版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3208440/