Data is transferred at business time and needs to be transcoded, from UTF-8 to GBK. PHP functions are relatively mentally retarded, leading to a large amount of data conversion failures. Is there a better transcoding method that can automatically ignore the codes in the content that cannot be converted successfully, so don't lose data? Data is transferred at business time and needs to be transcoded, from UTF-8 to GBK. PHP functions are relatively mentally retarded, leading to a large amount of data conversion failures. Is there a better transcoding method that can automatically ignore the codes in the content that cannot be converted successfully, so don't lose data?
Reply content:
Data is transferred at business time and needs to be transcoded, from UTF-8 to GBK. PHP functions are relatively mentally retarded, leading to a large amount of data conversion failures. Is there a better transcoding method that can automatically ignore the codes in the content that cannot be converted successfully, so don't lose data?
Http://php.net/manual/en/function.iconv.php
Use// IGNORE
To ignore words that cannot be converted
Php
Iconv ("UTF-8", "GBK // IGNORE", $ text );
The specified IGNORE mentioned above is a little bit, but there is still a BUG in this product, which is simply written as follows:
Http://www.yundaiwei.com/post/375.html
There is almost no introduction to this BUG on the Chinese website. It is mentioned on the English website, but it is not clear, and we do not know which or which versions will have bugs. In short, compile the latest iconv during Environment installation.