This article will introduce to you several solutions to the iconv() [function.iconv]: Detected an illegal character in error. Friends who need to know more can refer to it.
When using the iconv function to convert gb2312 to utf-8, why are there problems with some Chinese characters? Characters like "??quot; will be prompted as follows:
Notice: iconv() [function.iconv]: Detected an illegal character in input string
Solution:
The code is as follows
代码如下 |
复制代码 |
iconv('UTF-8', 'GB2312//IGNORE', '??')
iconv('UTF-8', 'GBK', '??')
|
|
Copy code
|
iconv('UTF-8', 'GB2312//IGNORE', '??')
iconv('UTF-8', 'GBK', '??')
Either the encoding is wrong, or the suppressor @ is added
We can also use other methods
Make a GBK To UTF-8
代码如下 |
复制代码 |
header("content-Type: text/html; charset=Utf-8");
echo mb_convert_encoding("???S我的友仔", "UTF-8", "GBK");
?>
|
Detailed explanation of how to use mb_convert_encoding()
代码如下 |
复制代码 |
header("content-Type: text/html; charset=big5");
echo mb_convert_encoding("你是我的朋友", "big5", "GB2312");
?> |
| Php code
Copy code
|
header("content-Type: text/html; charset=Utf-8");
echo mb_convert_encoding("???SMy friend", "UTF-8", "GBK");
?>
Another GB2312 To Big5
The code is as follows
|
Copy code
|
header("content-Type: text/html; charset=big5");
?>
http://www.bkjia.com/PHPjc/632119.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632119.htmlTechArticleThis article will introduce iconv() [function.iconv]: Detected an illegal character in several errors Friends who need to know the solution can refer to it. Use iconv function to convert gb2312 to...
|
|