PHPiconv solves UTF-8 and gb2312 encoding conversion problems. At last, the Emperor did not lose heart, but the answer still found me. The code for copying code on the internet is as follows: $ contenticonv (UTF-8, gb2312, $ content); in fact, the answer still gives me the answer.
This is the case on the Internet.
The code is as follows:
$ Content = iconv ("UTF-8", "gb2312", $ content );
This is actually the opposite. it seems that UTF-8 is indeed converted to gb2312, but the actual operation is often ended in failure. why?
The reason is actually very simple, because any function is executed incorrectly, and unfortunately iconv (); finally, an error occurs. Now let's give you the correct answer.
The real answer is:
The code is as follows:
$ Content = iconv ("UTF-8", "gb2312 // IGNORE", $ content );
Simply add a // IGNORE to the end, and the ICONV () function can IGNORE the error and continue execution.
Similarly, to replace gb2312 with UTF-8, you only need to write $ content = iconv ("gb2312", "UTF-8 // IGNORE", $ content );.
Bytes. The code used on the internet is as follows: $ content = iconv ("UTF-8", "gb2312", $ content); this is actually true...