用console.info输出,firebug控制台是正常的,但是脚本选项里面是乱码
钟毅2017-10-04 15:44:52
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.
大家讲道理2017-04-10 15:20:04
浏览器解析文件的编码和在meta
中指定的编码是不同的概念,浏览器未必按照meta
指定的编码解析文件,譬如:
指定文件编码为UTF-8
在浏览器中,指定编码为简体中文,就会乱码:
然后将浏览器编码调整为unicode
,解析正常
PHP中文网2017-04-10 15:20:04
meta 里面设置的编码方式是告诉浏览器,我这个文件的编码方式是 utf-8
,显示解码的时候要用utf-8
解码。但是如果你实际的编码使用是GB2321
,仍然告诉浏览器,我这个是utf-8
编码,那浏览器按照utf-8
解码显然会解出乱码。