Home >Web Front-end >JS Tutorial >Solution to utf-8 encoding causing js to output Chinese garbled characters_javascript skills

Solution to utf-8 encoding causing js to output Chinese garbled characters_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:24:461367browse

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.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn