iconv() Detected an illegal character in input string
2013-01-02 17:53
477 查看
在php中利用iconv函数转化汉字字符串时提示如下错误:
Notice: iconv() [function.iconv]: Detected an illegal character in input string in a.php on line 796
出错的语句如下:
iconv("GB2312","UTF-8",$a);
解决办法,将GB2312更改为GBK即可搞定:
iconv("GBK","UTF-8",$a);
出现这个错误的原因是字符串$a中出现了超出gb2312范围的字符,所以iconv函数出错。因为gbk范围比gb3212范围广,又因为这两种格式的编码相同只是范围不同而已,故采用大范围的gbk来定义字符串能够包含比较多的字符,因此转化成功!
Notice: iconv() [function.iconv]: Detected an illegal character in input string in a.php on line 796
出错的语句如下:
iconv("GB2312","UTF-8",$a);
解决办法,将GB2312更改为GBK即可搞定:
iconv("GBK","UTF-8",$a);
出现这个错误的原因是字符串$a中出现了超出gb2312范围的字符,所以iconv函数出错。因为gbk范围比gb3212范围广,又因为这两种格式的编码相同只是范围不同而已,故采用大范围的gbk来定义字符串能够包含比较多的字符,因此转化成功!
相关文章推荐
- iconv() [function.iconv]: detected an illegal character in input string
- iconv() Detected an illegal character in input string
- php iconv() : Detected an illegal character in input string
- iconv() : Detected an illegal character in input string 报错解决(抄的)
- php iconv() : Detected an illegal character in input string
- PHP的iconv()函数遇到的错误: Detected an illegal character in input string ...
- iconv() : Detected an illegal character in input string
- php iconv() : Detected an illegal character in input string
- mysql phpMyAdmin 导入报错iconv(): Detected an illegal character in input string原因解析
- PHP 读取EXCEL文件出现:Detected illegal character in input string解决
- PHP错误:iconv() Detected an illegal character
- php iconv() 编码转换出错 Detected an illegal character
- java.lang.IllegalArgumentException: URLDecoder: Illegal hex characters in escape (%) pattern - For input string: " 0"
- JNI DETECTED ERROR IN APPLICATION: input is not valid Modified UTF-8: illegal continuation byte 0x3f
- Notice: iconv() [function.iconv]: Detected an illegal ..问题
- URLDecoder: Illegal hex characters in escape (%) pattern - For input string: "6#" 解决方法
- PHP中利用ICONV转化字符串编码出错【DETECTED AN ILLEGAL CHARAC...
- URLDecoder: Illegal hex characters in escape (%) pattern - For input string:
- Notice: iconv() [function.iconv]: Detected an illegal ..问题
- JNI DETECTED ERROR IN APPLICATION: input is not valid Modified UTF-8: illegal continuation byte 0x12