About encoding basics a php file is the encoding (file attribute, default parameter) set in the compiler (eclipse), such as setting it to gb2312 and writing it in the file & lt; metahttp-equiv & quot; Content-Type & quot; content & quot; texthtml; charsetutf-8 & quot; & gt; or & nbsp; header (& about encoding basics
A php file
The encoding (file attribute, default parameter) set in the compiler (eclipse), for example, set it to gb2312.
And
Write down in the file
Or
Header ("content-type: text/html; charset = utf-8 ")
What is the relationship between them.
If I call ajax, the returned data format depends on the encoding format set by the editor, or
Header ("content-type: text/html; charset = utf-8 ")
Basic problem solving?
------ Solution --------------------
First, we need to understand the concept. encoding consists of file encoding and Output Content encoding.
1. eclipse encoding refers to file encoding.
2. the output content of html and php is UTF-8 encoded.
3. the format returned by ajax is determined by the php file output format, that is, the header ....
Note that the output encoding of the file encoding must be consistent.
In addition, if json is required, use UTF-8. if it is not possible to convert Chinese characters to iconv before output.