There are several reasons why Chinese garbled characters appear on PHP pages. One is that the page encoding is not counted. The second is that the encoding is not set in the database. The third is that there is a problem with the apache encoding. Let me introduce two solutions to you. Overall It means that the page encoding is not uniform.
Garbled characters are mostly caused by inconsistencies in encoding methods. There are mainly four inconsistencies that may cause this possibility:
1. Page file encoding method (.html, .php, etc.)
2. Specify the encoding method of the browser in html.head
3. Encoding method for MySql database transmission
4. Apache character set
On a page with only PHP code, when creating a JS pop-up window, if the content of the pop-up window contains Chinese characters, garbled characters may occur,
Solution, one line of code:
Chinese garbled characters on the page
The code is as follows
|
Copy code
|
||||||
|
|||||||
1. 2.mysql_query('SET NAMES UTF8'); 3. //The next step is to find the data or modify it and add it 4.?> Note: 1. This code must be placed at the top of the file, after ‘ 2. The charset value depends on the entire website code. If it is gb2312, fill in gb2312. http://www.bkjia.com/PHPjc/633211.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/633211.htmlTechArticleThere are several reasons why Chinese garbled characters appear on PHP pages. One is that the page encoding does not count, and the other is that the database does not Set the encoding. The third is that there is a problem with the apache encoding. Let me introduce two solutions to you... |