搞不懂你,既然是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>