Welcome to the Linux community forum, interact with 2 million technical staff to enter 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 many disadvantages. Does not support GBKTOUTF-8 but one to find or in PHP official FAQ found mb_convert_encoding () the function
Welcome to the Linux community forum, interact with 2 million technical staff> enter 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 gbk to UTF-8 but one TO find or in the PHP official FAQ found mb_convert_encoding () the function
Welcome to the Linux community forum and interact with 2 million technicians>
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 ");
?>