There are about 4 places where garbled characters appear:
1. The encoding method of the file (that is, the encoding of your new file), this requires setting the editor encoding method.
2. The page does not specify the browser encoding display method. The solution is:
1. If the page is .html, you need to set ,
2 If it is an x.php file, you need to add header ("content-type: text/html; charset=utf-8") at the head. In total What it means is to tell the browser that I want utf-8 encoding to display the page.
3. Specify the encoding of the database when creating a new database, and add mysql_query("set names utf8") when linking to the database; specify that the information encoding output by the database is utf-8.
4. When using ajax, you need to specify the encoding of the received data on the receiving page. Use the function iconv().
In short: all encodings are unified. No matter the encoding is utf-8 or gbk, etc.