如何在浏览器中强制UTF-8编码? [英] How to force UTF-8 encoding in browser?
本文介绍了如何在浏览器中强制UTF-8编码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有页面用
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
但是当我输入页面时,在浏览器中选择另一个编码我试图通过PHP方法设置编码
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');
但它也没有帮助。所有源文件都以UTF-8编码,不带BOM。我尝试和唯一的解决方案是通过添加 AddDefaultCharset UTF-8
行在 .htaccess
,但是服务器上的其他页面无法正确显示。如何解决此问题?
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?
推荐答案
禁用默认字符集:
AddDefaultCharset Off
这篇关于如何在浏览器中强制UTF-8编码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文