Recently, I am working on a thief program. I need to use the iconv function to convert the captured UTF-8 encoded page to gb2312, it is found that only the iconv function can be used to convert the captured data into less data for no reason. I was depressed for a while. I checked the information on the Internet to find out that this is a bug in the iconv function. Iconv will "> <LINKhref =" http:
Recently, I am working on a thief program. I need to use the iconv function to convert the captured UTF-8 encoded page to gb2312,
It is found that only the iconv function can be used to convert the captured data into less data for no reason.
I was depressed for a while. I checked the information on the Internet to find out that this is a bug in the iconv function. An error occurs when iconv converts the character "-" to gb2312. phperz.com
The solution is simple. add "// IGNORE" after the code to be converted, that is, the second parameter of the iconv function, as follows:
Reference content is as follows:
Iconv ("UTF-8", "GB2312 // IGNORE", $ data)
Ignore indicates that the conversion error is ignored. without the ignore parameter, all strings after this character cannot be saved.