Finally, Huangtian paid off and I found the answer.
This is how it is used on the Internet
Copy the code The code is as follows:
$content = iconv("utf-8","gb2312",$content);
This is actually correct. It looks like it is indeed converting utf-8 to gb2312. But in actual operation, it often ends in failure. What is the reason?
The reason is actually very simple, because any function will have an execution error, and unfortunately iconv(); will eventually cause an error. Now give you the correct answer.
The real answer is this
Copy code The code is as follows:
$content = iconv("utf-8","gb2312//IGNORE",$content);
It’s very simple, just add //IGNORE after it, just add this ICONV() function ignores errors and continues execution.
Similarly, to change gb2312 to utf-8, just write $content = iconv("gb2312","utf-8//IGNORE",$content);
http://www.bkjia.com/PHPjc/321499.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/321499.htmlTechArticleFinally, Huangtian paid off and I found the answer. The copy code used on the Internet is as follows: $content = iconv("utf-8","gb2312",$content); This is actually the same as...