monjevin
monjevin

Reputation: 177

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?

Upvotes: 2

Views: 5649

Answers (1)

Fwolf
Fwolf

Reputation: 691

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.

Upvotes: 1

Related Questions