【发布时间】:2018-07-04 01:33:26
【问题描述】:
我想将 Unicode 代码点转换为字符。这是我尝试过的:
$point = dechex(127468); // 1f1ec
echo "\u{1f1ec}"; // this works
echo "\u{$point}"; // this outputs '\u1f1ec'
echo "\u{{$point}}"; // Parse error: Invalid UTF-8 codepoint escape sequence
echo "\u\{{$point}\}"; // outputs \u\{1f1ec\}
echo "\u{". $point ."}"; // Parse error; same as above
【问题讨论】:
-
嗯嗯。如果不可能的话,这似乎是一种迷失的情况:) 不过下面的答案是有道理的。