如何在浏览器中强制使用UTF-8编码?
我有一个声明编码的页面,
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
但是当我进入页面时,在浏览器中选择了另一种编码(ISO)。我尝试通过 PHP 方法设置编码
header('Content-type: text/html; charset=utf-8');
但它也没有帮助。所有源文件均采用 UTF-8 无 BOM 编码。我尝试过并且有效的唯一解决方案是通过添加 AddDefaultCharset UTF-8
行在 .htaccess 文件中设置编码,但服务器上的其他页面无法正确显示。我该如何解决这个问题?
I have page which encoding is declared with
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
But when I enter the page another encoding (ISO) is chosen in browser. I have tried to set encoding by PHP method
header('Content-type: text/html; charset=utf-8');
But it also didn't help. All source files are encoded in UTF-8 without BOM. The only solution which I tried and it had worked was setting encoding in .htaccess
file by adding AddDefaultCharset UTF-8
line, but then another pages on the server were not displayed correctly. How can I solve this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
禁用默认字符集:
Disable default charset: