Most of the garbled characters are caused by inconsistent encoding methods. four major inconsistencies may exist: 1. page file encoding methods (such as html and php) 2. specify the encoding method of the browser in htmlhead. 3. MySql database transmission.
Most of the garbled characters are caused by inconsistent encoding methods. There are four major inconsistencies that may exist:
1. the format of the webpage file (.html,. php, etc)
2. specify the browser encoding method in html. head.
3. encoding for MySql database transmission
4. Apache character set
InOnly pages with PHP codeWhen creating a JS pop-up window, if the pop-up window contains Chinese characters, garbled characters may occur. solution: one line of code:
Header ("Content-Type: text/html; charset = utf-8 ");
The database is garbled:
-
- Mysql_query ('set NAMES utf8 ');
- // The next step is to find or modify the data and add
- ?>
Note:1. This code must be placed at the top of the file ,'