字符编码间的转换
时间:2007-09-30 来源:liuxingyuyuni
mb_convert_encoding 方法
?php
header("content-Type: text/html; charset=gb2312");
/* Convert EUC-JP to UTF-7 */
$str = "是是是是是非曲直";
$strTest1 = mb_convert_encoding($str, "UTF-8", "GB2312");
$strTest2 = mb_convert_encoding($str, "GB2312", "UTF-8");
echo $strTest1;
echo "
";
echo $strTest2;
?>
iconv 方法
//将$convertString 由gb2312编码转化为UTF-8,不过服务器不一定支持
?php
echo iconv("GB2312", "UTF-8", $convertString);
?>
相关阅读 更多 +
排行榜 更多 +