Text encoding conversion mb_convert_encoding()
mb_convert_encoding( $str, $encoding1,$encoding2 )
$str, the encoding string to be converted
$encoding1, target encoding, such as utf-8, gbk, both upper and lower case can be used
$encoding2, original encoding, such as utf-8, gbk, both upper and lower case can be used
Example 1
Copy code The code is as follows:
$str='Script Home: http://www.jb51.net';
echo mb_convert_encoding($str , "UTF-8"); //Convert encoding to utf-8
?>
Copy code The code is as follows :
$str='Script Home: http://www.jb51.net';
echo mb_convert_encoding($str, "UTF-8" , "GBK"); //The original encoding is known to be GBK, converted to utf-8
?>
Copy code The code is as follows:
$str='Script Home: http://www.jb51.net';
echo mb_convert_encoding($str, " UTF-8", "auto"); //Unknown original encoding, after automatic detection by auto, convert the encoding to utf-8
?>
The encoding conversion function mb_convert_encoding under PHP and Instructions for use of iconv
http://www.bkjia.com/PHPjc/324579.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/324579.htmlTechArticleConversion of text encoding mb_convert_encoding() mb_convert_encoding( $str, $encoding1,$encoding2 ) $str, to convert the encoding String $encoding1, target encoding, such as utf-8, gbk, both case...