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 converting utf-8 to gb2312, but in actual operation, it is often run as It failed. What's 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, and adding this can be ignored by the ICONV() function Error, continue execution.
Similarly, to change gb2312 to utf-8, just write $content = iconv("gb2312","utf-8//IGNORE",$content);
http://www.bkjia.com/PHPjc/321562.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/321562.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...