Problem description:
A JSP-based Web business project, charset of the page is declared as UTF-8, JB project is also declared as UTF-8 code, when using a JS file to store various districts and counties, the JSP page reports an error (no method in JS is called, but an error is reported when the JS file is included, and the "character is not terminated ). Incorrect display of Chinese characters using JB.
Solution:
Later I found that the file encoding of this JS file is GB, not in the utf8 project. Therefore, you only need to open the JS file in JB that declares that the file encoding is not utf8 and re-enter all Chinese characters.
In addition, ultraedit has this conversion tool. Open this JS file in ultraedit and select "file"> "Conversion"> "ASCII to utf8" to complete the conversion, if there are other encoding conversions, there are still many options under this command menu.
Conclusion:
Each file has a file encoding. By default, if we do not set the file encoding in IDE such as JB, the characters in any file are entered with the default local encoding, for example, the Chinese system is about GB, And if file encoding is set in IDE, the byte arrays of characters entered in the same input method are not exactly the same, the sample shows that the byte arrays of Chinese Characters in non-encoded files are different.