Home  >  Article  >  Backend Development  >  How to convert PHP utf8 to Chinese

How to convert PHP utf8 to Chinese

藏色散人
藏色散人Original
2020-07-06 09:13:456778browse

How to convert utf8 to Chinese: first decode the encoded URL string through the "urldecode" function; then use the "mb_convert_encoding" function to convert the character encoding; and finally output the conversion result.

How to convert PHP utf8 to Chinese

Specific question:

To convert a specified set of UTF-8 encoded Chinese characters into normal Simplified Chinese

I tried the mb_convert_encoding function, but it didn’t work. The string I want to convert is encoded in this way. I don’t know if this is UTF-8 encoding

Jilin

Use other tools to transfer this set of codes. The tool shows "Jilin"?

Solution:

<?
$a=urldecode("%E5%90%89%E6%9E%97");
$a=mb_convert_encoding($a, &#39;GB2312&#39;, &#39;UTF-8&#39;);
echo $a;
?>

For a lot of related knowledge, please visit PHP Chinese website!

The above is the detailed content of How to convert PHP utf8 to Chinese. For more information, please follow other related articles on the PHP Chinese website!

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