Home >Web Front-end >Front-end Q&A >What to do if the javascript pop-up box is garbled
Solution to the garbled javascript pop-up box: 1. Add "charset="utf-8"" to the js introduction code; 2. Add "charset='utf-8'" code to the head. Can.
The operating environment of this article: windows7 system, javascript version 1.8.5, DELL G3 computer
What should I do if the javascript pop-up box is garbled?
Solution to the problem that the javascript pop-up window is garbled:
1. Add charset="utf-8"
<script charset="utf-8" language="javascript" type="text/javascript" src="JS/CommonFields/common.js"> </script>
charset character set to the js introduction code Description, set to utf-8.
2. Add the following code between 93f0f5c25f18dab9d176bd4f6de5d30e9c3bca370b5104690d9ef395f2c5f8d1:
<meta http-equiv="Content-Type" content="text/html; charset='utf-8'" />
garbled code:
when Chinese When read as unrecognizable characters, it is called garbled characters.
The root cause of garbled characters:
The file has an encoding format when it is saved. It can only be read correctly when the encoding format used when saving is the same as the encoding format used when reading. Files; for example, both UTF-8 encoding and GBK encoding can read Chinese. If UTF-8 encoding is used to save the file, but GBK encoding is used to read the file, it will cause garbled characters. Therefore, files saved in UTF-8 encoding should use UTF- 8 code reading.
The encoding format of the file includes: UTF-8 encoding, GBK encoding, ANSI encoding, GB2312 encoding
Recommended learning: "javascript basic tutorial"
The above is the detailed content of What to do if the javascript pop-up box is garbled. For more information, please follow other related articles on the PHP Chinese website!