Home >Backend Development >PHP Tutorial >PHP solves the problem of Chinese garbled characters

PHP solves the problem of Chinese garbled characters

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-29 09:12:181146browse

I am new to PHP. When transferring and converting Chinese characters between pages, I encountered the problem of Chinese garbled characters.
The reason for the garbled code is nothing more than the following situations:
1. The garbled code problem of the html page itself,
Solution: Use pure html page <meta http-equiv="Content-type=text/html;charset=utf-8"/>

2. The php page itself has garbled characters, solution:

<code><span><span>header</span></span>(<span>"Content-type=text/html;charset=utf-8"</span>);</code>

3. There are no errors in the HTML page and the PHP processing page, but the data is garbled during the transmission process. At this time, you should consider whether the encoding methods of the HTML page and the PHP processing page are consistent. Only when the encoding methods are consistent can the correct data be obtained. data information. For example, if the html page is encoded using gb2312, then your php page must also use gb2312 encoding for page processing. Only in this way will there be no garbled code like the following:
??¢è????¥??°?-¤???é?¢??????¨?·2???é???????.

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above has introduced PHP to solve the problem of Chinese garbled characters, including aspects of the problem. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn