使用 int 将 Astral Plane Unicode 代码点打印到控制台
请参阅此处的相关问题。
但是,char
会转到 0xffff
(或 65535
)。我需要编写 0xd800df46
(或 66374
),哥特式字母 Faihu,因此将 int
转换为 char
不会工作。我完成了转换,也就是说,我得到了正确的整数,这意味着我计算了代理对,但我不知道如何“渲染”它,将其转换为要作为字形输出的字符。
请注意,我不能使用 \Unnnn ......好吧,理论上的原因。
谢谢。
Please see here for a related question.
However, char
goes to 0xffff
(or 65535
). I need to write 0xd800df46
(or 66374
), Gothic letter Faihu, so casting that int
to char
will not work. I do the conversion ok, that is, I get the correct integer, meaning I calculate the surrogate pairs ok, but I don't know how to "render" it, convert it to a character to be output as a glyph.
Please notice that I cannot use \Unnnn for ... well, theoretical reasons.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,您需要将单个整数转换为表示为字符串的代理对:
对于更多操作,您可以在<中使用我的
Utf32String
类a href="http://pobox.com/~skeet/csharp/miscutil" rel="nofollow noreferrer">MiscUtil,以及System.Char
中的各种其他方法。Okay, you need to convert a single integer into a surrogate pair which you'd represent as a string:
For more operations than that, you can use my
Utf32String
class in MiscUtil, as well as various other methods inSystem.Char
.