Iconv transcoding fails on the UTF-8 encoding page in php. This article introduces the loss of interrupted content when iconv encounters a character that cannot be transcoded when the UTF8 encoding page is stored in GBK data. if you encounter such problems, refer. This article introduces how to use iconv to interrupt content loss when UTF-8 encoding pages are stored in GBK data and how to solve this problem when iconv encounters a character that cannot be transcoded. For more information, see.
When iconv encounters a character that cannot be transcoded, the interrupted content is lost.
| The code is as follows: |
|
|
$ C = 'Test • character transfer • Happy May Day! ';
Echo iconv ('utf-8', 'gbk', $ c ); |
Only outputs: test
The plenary session is missing.
Solution:
Add // IGNORE
| The code is as follows: |
|
|
$ C = 'Test • character transfer • Happy May Day! ';
Echo iconv ('utf-8', 'gbk // IGNORE ', $ c ); |
Input: test character transfer for Happy May Day!
Ignore indicates that the conversion error is ignored. without the ignore parameter, all strings after this character cannot be saved.
In this way, the same
Bytes. About iconv...