Home > Article > Web Front-end > Solution to garbled code problem in Js,alert_javascript skills
The js file that was still working normally a few days ago, after adding some things, the alert() pop-up prompt box was always garbled in Chinese. I read a lot on the Internet, and the answer was basically to add a < ;meta http-equiv="Content-Type" content="text/html;charset=gb2312" /> Or replace gb2312 with utf-8. I have tested it with various methods for a long time but still cannot solve this problem.
Solution:
Finally, I found something in a corner of a forum. It turns out that when referencing js files in HTML, you need to specify the encoding method of the character set. The specific method is . It’s strange, how come it wasn’t garbled before? …