Unicode surrogate pairs

為{幸葍}努か 提交于 2019-12-04 21:25:27

If you want to do it manually:

echo chr(0x30) . chr(0x6f) . chr(0x30) . chr(0xfc);

If you have the string, you could always do:

$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);

Or, if php < 5.3

$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);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!