Home >Web Front-end >JS Tutorial >Solution to utf-8 encoding causing js to output Chinese garbled characters_javascript skills
The encoding rule is utf-8, such as in the web page header:
If there is Chinese output in the js file, garbled characters will appear. There are two ways to solve this problem:
1. Add charset="gb2312" or charset="big5" where the JavaScript output is quoted (assuming the output is Big5 traditional Chinese characters).
Example:
2. Save the js file as utf-8 encoding.