刚才谁问采集到的\u5357\u4EAC\u5E02如何处理
<?php$str = '\u5357\u4EAC\u5E02';
//转换单一字符到GBK汉字
function ucs2chr_to_gbkchr($chr)
{
if(preg_match("/^%u({4})$/i",$chr,$match))
{
$unicode = $match;
$hex_unicode = hexdec($unicode);
$hz_string = pack('n',$hex_unicode);
$chr = iconv('UCS-2','GBK',$hz_string);
}
return $chr;
}
//转换UCS2字符串到GBK字符串
function htmlucs2_to_gbk($string)
{
if(preg_match_all("/%u({4})/i",$string,$match))
{
$replace = array ();
foreach($match as $item)
{
$replace[] = ucs2chr_to_gbkchr ($item);
}
$string = str_replace($match,$replace,$string);
}
return $string;
}
echo htmlucs2_to_gbk(str_replace('\\', '%', $str));
?> 记号。 牛Bali68ls 2009里支持解码这种html实体字符
System/Config.ini
搜索
HtmlDecode=False改为True 2009里支持解码这种html实体字符
System/Config.ini
搜索
HtmlDecode=False改为True
火车头 发表于 2009-3-7 11:13 http://bbs.locoy.com/images/common/back.gif
试了一下 行不通 照样是代码
页:
[1]