搞不懂你,既然是unicode,那你干嘛要用ucs-2
<?
$contents=file_get_contents("Unicode.txt");$contents = iconv("unicode", "gb2312", $contents);
for($i=0;$i<strlen($contents);$i++){echo DecHex(ord(substr($contents,$i,1)))." ";}
echo "<hr>\n";$contents = iconv("gb2312", "unicode", $contents);
for($i=0;$i<strlen($contents);$i++){echo DecHex(ord(substr($contents,$i,1)))." ";}
echo "<hr>\n";
?>
输出:
c4 e3 ba c3 b1 a6 b1 b4 <hr>
fe ff 4f 60 59 7d 5b 9d 8d 1d <hr>
<?
$contents=file_get_contents("Unicode.txt");$contents = iconv("unicode", "gb2312", $contents);
for($i=0;$i<strlen($contents);$i++){echo DecHex(ord(substr($contents,$i,1)))." ";}
echo "<hr>\n";$contents = iconv("gb2312", "unicode", $contents);
for($i=0;$i<strlen($contents);$i++){echo DecHex(ord(substr($contents,$i,1)))." ";}
echo "<hr>\n";
?>
输出:
c4 e3 ba c3 b1 a6 b1 b4 <hr>
fe ff 4f 60 59 7d 5b 9d 8d 1d <hr>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货