This article describes how to solve the problem of truncation Characters During iconv function transcoding in PHP. The solution provided in this article is to use mb_convert_encoding to replace iconv. For more information, see
This article describes how to solve the problem of truncation Characters During iconv function transcoding in PHP. The solution provided in this article is to use mb_convert_encoding to replace iconv. For more information, see
Iconv is a conversion code, but it is not displayed completely during Chinese transcoding.
The Code is as follows:
Iconv ("UTF-8", "GB2312 // IGNORE", $ data); with // IGNORE, IGNORE errors
Or use mb_convert_encoding ()
The Code is as follows:
<? Php
/* Convert the internal code to SJIS */
$ Str = mb_convert_encoding ($ str, "SJIS ");
/* Convert EUC-JP to UTF-7 */
$ Str = mb_convert_encoding ($ str, "UTF-7", "EUC-JP ");
/* Automatically detects encoding from JIS, eucjp-win, sjis-win, and converts str to UCS-2LE */
$ Str = mb_convert_encoding ($ str, "UCS-2LE", "JIS, eucjp-win, sjis-win ");
/* "Auto" extended to "ASCII, JIS, UTF-8, EUC-JP, SJIS "*/
$ Str = mb_convert_encoding ($ str, "EUC-JP", "auto ");
?>
Use mb_conver_encoding for insurance