Because a program to use the output UTF-8 encoding but the original data is GBK encoding Baidu found a lot of internal code conversion class but there are many disadvantages. Does not support GBKTOUTF-8 but one to find or in PHP official FAQ found mb_convert_encoding () the function to be in PHP... SyntaxHighlighter. all ()
Because a program needs to output UTF-8 encoding, but the original data is GBK encoding
Baidu has found many classes related to internal code conversion, but there are many disadvantages. Does not support gbk to UTF-8
However, I found mb_convert_encoding () in the official PHP FAQ. This function is available only after PHP4.0.6 or above.
Link: http://cn.php.net/manual/zh/function.mb-convert-encoding.php
Make a GBK To UTF-8
<? Php
Header ("content-Type: text/html; charset = Utf-8 ");
Echo mb_convert_encoding ("You are my friends", "UTF-8", "GBK ");
?>
Another GB2312 To Big5
<? Php
Header ("content-Type: text/html; charset = big5 ");
Echo mb_convert_encoding ("You are my friend", "big5", "GB2312 ");
?>