【发布时间】:2010-08-17 19:21:52
【问题描述】:
假设我有一对代理。例如:
\u306f\u30fc
有没有可以将字符打印到屏幕上的功能?
【问题讨论】:
标签: php unicode surrogate-pairs
假设我有一对代理。例如:
\u306f\u30fc
有没有可以将字符打印到屏幕上的功能?
【问题讨论】:
标签: php unicode surrogate-pairs
如果你想手动操作:
echo chr(0x30) . chr(0x6f) . chr(0x30) . chr(0xfc);
如果你有字符串,你总是可以这样做:
$callback = function($match) {
return chr(hexdec($match[1])) . chr(hexdec($match[2]));
}
preg_replace_callback('#\\\\u([0-9a-f]{2})([0-9a-f]{2})#', $callback, $string);
或者,如果 php
$callback = create_function('$match',
'return chr(hexdec($match[1])) . chr(hexdec($match[2]));'
);
preg_replace_callback('#\\\\u([0-9a-f]{2})([0-9a-f]{2})#', $callback, $string);
【讨论】: