Today encountered a thorny problem, in the old project Riga some JS files and old project coding format inconsistencies appear garbled. The old page is GB2312, the link into the JS file is UTF-8, two files can not be transferred format.
The first idea is to convert the Chinese in the JS file to Unicode encoding. This approach is based on the expense of readability of the conditions, the Chinese all become a password.
Afterwards think that there should be a better way, and then go to Baidu, the following methods:
Copy Code code as follows:
<script type= ' text/javascript ' src= ' xxxuft.js ' charset= ' utf-8 ' ></script>
Add the red setting, which means specifying the encoding format for the JS file. This method is also suitable for the server-side dynamically generated JS file front-end personnel can not transcoding, and cross-domain loading of other people's Web site JS files.