iconv () function can replace GB2312 to utf-8
[code]$text=iconv (.Quot; GB2312.quot;.Quot; UTF-8.quot; $text); The characters in the English name "," and so on, the conversion is broken. The characters after these characters can not be changed.
for this problem, you can use the following code to implement
[code]$text=iconv (.Quot; UTF-8.quot;.Quot; GBK.quot; $text); [/code]
you are not mistaken, so simple, not using GB2312, it is OK.
there is another way:
second parameters, plus //IGNORE, ignoring the error, as follows:
[code]iconv (.Quot; UTF-8.quot;.Quot; GB2312//IGNORE.quot; $data); NV ()
[code] iconv
(PHP 4.Gt; 4.0.5, PHP 5)
[code]string. The string is truncated.
can be solved at this time using the following methods:
[code]//author:zhxia
$str=iconv ('UTF-8', "" gb2312//TRANSLIT ", file_get_contents ($filepath)); [/code]
that is to add a red word part in second parameters, indicating that if the character matching the source code in the target code is not found. A similar character is selected for conversion.
can also be used here: //IGNORE, which means that characters that cannot be converted are ignored.