21,886
社区成员
发帖
与我相关
我的任务
分享
$str=preg_replace("/\\\u(.{4})/","\".unicode2gb2312('\\1').\"",$str);
$str = "\$str=\"$str\";";
eval($str);
print $str;
print unicode2gb2312("7D20");
function unicode2gb2312($str) {
// $bs = split('\u',$str);
$bs=$str;
$c = "";
// for($i = 1; $i < count($bs); $i++) {
$c .= chr(hexdec(substr($bs,2)));
$c .= chr(hexdec(substr($bs,0,2)));
// }
$c = iconv('UTF-16', 'GB2312', $c);
// echo $c;
return $c;
}