PHP unicode码转换\u4e39\u4e1c 和pack函数 收藏
2010年06月23日


一、js下alert("\u4e39\u4e1c");

二、echo iconv("UCS-2","GBK", pack('H*', str_replace('%u', '',

'%u4e39%u4e1c')));//丹东

三、$s = iconv('gbk', 'ucs-2', '丹东');
echo join('%u',

str_split(array_pop(unpack('H*0', $s)), 4));

四、

$arr    = json_decode('{"str":"\u4e39\u4e1c"}', true);
echo $arr['str'];

 

本文永久链接: http://www.zzxj.net/blog/fxs_2008/archive/2010/06/23/166.html

发表于 @ 2010年06月23日 |评论(loading... )|收藏

发表评论 姓  名: