<?php 
function unicode_urldecode($url){
preg_match_all('/%u([[:alnum:]]{4})/', $url, $a);
foreach ($a[1] as $uniord) {
$dec = hexdec($uniord);
$utf = '';
if ($dec < 12) {
$utf = chr($dec);
} else if ($dec < 204) {
$utf = chr(192 + (($dec - ($dec % 64)) / 64));
$utf .= chr(128 + ($dec % 64));
} else {
$utf = chr(224 + (($dec - ($dec % 4096)) / 4096));
$utf .= chr(128 + ((($dec % 4096) - ($dec % 64)) / 64));
$utf .= chr(128 + ($dec % 64));
}
$url = str_replace('%u' . $uniord, $utf, $url);
}
return urldecode($url);
}
$source = '%u306E%u610F%u5473%u3084%u548C%u8A33%u3002 %u30B8%u30E7%u30FC%u30AF%u30E9%u30C3%u30B7%u30E3 - %u7D04982%u4E07%u8A9E%u3042%u308B%u82F1%u548C%u8F9E%u5178%u30FB%u548C%u82F1%u8F9E%u5178%u3002%u767A%u97F3%u30FB%u30A4%u30C7%u30A3%u30AA%u30E0%u3082%u5206%u304B%u308B%u82F1%u8A9E%u8F9E%u66F8%u3002';
$source = unicode_urldecode($source);
var_dump($source);

函数整理自:
http://bbs.chinaunix.net/thread-834482-1-1.html

Related Posts: PHP-%u 解码 :