Home > php教程 > php手册 > iconv() [function.iconv]: Detected an illegal character in

iconv() [function.iconv]: Detected an illegal character in

WBOY
Release: 2016-06-13 09:57:06
Original
1120 people have browsed it

本文章来给大家介绍iconv() [function.iconv]: Detected an illegal character in 错误的几种解决办法,有需要了解的朋友可参考。

用iconv函数将gb2312转换为utf-8时,怎么有些汉字会出现问题,像"??quot;字就会提示如下:
Notice: iconv() [function.iconv]: Detected an illegal character in input string

解决方法:

 代码如下 复制代码

iconv('UTF-8', 'GB2312//IGNORE', '??')
iconv('UTF-8', 'GBK', '??')

或者是编码不对,或者增加抑制符@

我们还可以使用其它方法操作

做一个GBK To UTF-8


mb_convert_encoding()使用详解

Php代码 

 代码如下 复制代码

header("content-Type: text/html; charset=Utf-8");
echo mb_convert_encoding("???S我的友仔", "UTF-8", "GBK");
?>


再来个GB2312 To Big5 
 

 代码如下 复制代码
header("content-Type: text/html; charset=big5");  
echo mb_convert_encoding("你是我的朋友", "big5", "GB2312");  
?> 
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template