Setting UTF-8 in JAVASCRIPT has no effect. The key is that you need to uniformly set it to UTF8 in COMMON. META alone cannot control the operation. The previous page is displayed in UTF-8. If it is under the WINDOWS platform, it will automatically change to GBK format. Pay attention to this. Therefore, it is best to use a framework such as THINKPHP to unify settings.
Setting UTF-8 in JAVASCRIPT has no effect. The key is that you need to uniformly set it to UTF8 in COMMON. META alone cannot control the operation. The previous page is displayed in UTF-8. If it is under the WINDOWS platform, it will automatically change to GBK format. Pay attention to this. Therefore, it is best to use a framework such as THINKPHP to unify settings.
浏览器解析文件的编码和在
meta
中指定的编码是不同的概念,浏览器未必按照meta
指定的编码解析文件,譬如:指定文件编码为
UTF-8
在浏览器中,指定编码为简体中文,就会乱码:
然后将浏览器编码调整为
unicode
,解析正常meta 里面设置的编码方式是告诉浏览器,我这个文件的编码方式是
utf-8
,显示解码的时候要用utf-8
解码。但是如果你实际的编码使用是GB2321
,仍然告诉浏览器,我这个是utf-8
编码,那浏览器按照utf-8
解码显然会解出乱码。编辑工具打开的方式不对。