When the mb_convert_encoding function UTF-8 is converted to gbk, the question mark of space is changed. how can this problem be solved? Only spaces are converted into question marks, and other Chinese characters are normal.
Reply to discussion (solution)
This is related to your editor. spaces are not standard spaces.
Can you
Echo base64_encode (your UTF-8 string ');
Posting result 1
I suspect that it is not a common space.
This is related to your editor. spaces are not standard spaces.
Can you
Echo base64_encode (your UTF-8 string ');
Posting result 1
This article says that this space is special, 0xC2 0xA0.
Http://hi.baidu.com/lilong2114311/item/6d0b20c87ede71c8984aa097
But I try to convert
$in = 'UTF-8';$out = 'GBK';$str = str_replace("0xC2 0xA0", ' ', $str);//$str = mb_convert_encoding($str, $out, $in);
It has no effect. please advise
This is related to your editor. spaces are not standard spaces.
Can you
Echo base64_encode (your UTF-8 string ');
Posting result 1
The complete code is as follows:
This is related to your editor. spaces are not standard spaces.
Can you
Echo base64_encode (your UTF-8 string ');
Posting result 1
Search for "The fourth generation Fire in Muye ninja village, the country of fire" on the page. There are four question marks in front.
Check the source code and check that the Space is not normal (0x20), but 0xA0: No-Break Space (that is, nbsp)
You can't blame others if you're wrong.
$ Str = str_replace ("0xC2 0xA0", '', $ str );
Should be
$ Str = str_replace ("\ xC2 \ xA0", '', $ str );
In addition, the source code has a bom header.