简体   繁体   中英

iconv Detected an illegal character in input string

I don't know chinese language. But I faced problem using these codes:

iconv('UTF-8', 'GB2312', '在世界自由软件日给中国自由软件爱好者的视');

runs ok with no problem.

and this one:

iconv('UTF-8', 'GB2312', '冠軍集團安心居台北旗艦總店開幕酒會暨記者會');

which causes error:

Message: iconv(): Detected an illegal character in input string

Both are chinese but what's the difference?

Your second string is not GB2312 encode, it's BIG5 encoding.

So, you should use 'GBK' as 'from encoding' instead, which covers GB2312 and BIG5.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM