How to solve PHP Chinese garbled characters ,. How to solve PHP Chinese garbled text, how to solve PHP Chinese garbled text Problem 1. how to solve Chinese garbled text in HTML 1. add UTF8 encoding (International encoding) to the head tag ): UTF-8 is how to solve PHP Chinese garbled problem,
How to solve PHP Chinese garbled characters
I. solutions to Chinese garbled characters in HTML
1. add UTF8 encoding (International code) to the head label: the UTF-8 is not country-specific, that is, it is independent of any language, any language can be used.
2, the file encoding stored as a UTF-8. Notepad, Editplus, and other editors can select encoding when saving files.
2. HTML and PHP hybrid page solution
In addition to the operations described in the first method, you also need to add the code at the top of the file:
Header ("Content-type: text/html; charset = utf-8 ");
?>
3. Chinese garbled characters on pure PHP pages (static data)
This only needs to add the following code at the beginning of the page, and then save the UTF-8 encoding file.
Header ("Content-type: text/html; charset = utf-8 ");
?>
4. Chinese garbled characters in PHP + Mysql
In addition to the operations described in the third point, you must add the database encoding before you query, modify, and add data. Furthermore, it is worth noting that the UTF8 here is different from the previous one, and there is no horizontal line in the middle.
Mysql_query ('set NAMES utf8 ');
// The next step is to find data or modify and add
?>
5. correctly display the Chinese name of the uploaded attachment
Find the file config. php in xampp/moodle,
Add $ CFG-> unicodedb = true; and then add $ CFG-> unicodecleanfilename = true;
So that the accessories uploaded by the lamp can display the Chinese name correctly.
6. garbled characters may be displayed during File upload in IE browser.
Lib/editor/htmlarea/coursefiles. php
The second line adds the following sentence: // you can use: set nu to display the row number.
@ Header ("Content-Type: text/html; charset = utf-8"); // This is the default UTF-8 encoding.
Coding, how to solve PHP Chinese garbled problem 1, solve the problem of Chinese garbled characters in HTML method 1, add UTF8 encoding in the head label (International code): UTF-8 is...