简体   繁体   English

如何在0xFFFF以上打印字符?

[英]How to print a character above 0xFFFF?

I wonder if it is possible to print a character above 0xFFFF with Windows? 我想知道是否可以使用Windows在0xFFFF以上打印字符?

I am using Microsoft Visual Studio 2010 along with Windows XP. 我正在将Microsoft Visual Studio 2010和Windows XP一起使用。 A character is 16 bits wide so codepoints greater than 0xFFFF cannot really fit into a single char. 字符为16位宽,因此大于0xFFFF代码点实际上无法放入单个char中。 Even when I try this: 即使我尝试这样做:

int codepoint = char.ConvertToUtf32(charHS, charLS);

I will get the codepoint from the surrogate pair, but it still doesn't fit into a char. 我将从代理对中获取代码点,但它仍然不适合char。

If I paste a character from the higher multilingual planes into a string within C#, the string will have the length 2. If I try to print the string then I will print the two surrogate characters, which are not characters, EG, have no codepoint by themselves, only as a pair, instead of the "real" character. 如果我从较高的多语言平面中将一个字符粘贴到C#中的字符串中,则该字符串的长度为2。如果我尝试打印该字符串,则将打印这两个替代字符,它们不是EG,也没有代码点仅作为一对,而不是“真实”字符。

Shouldn't there be something like a 32-bit wide character that can hold codepoints higher than 0xFFFF ? 是否不应该有32位宽的字符可以容纳高于0xFFFF代码点?

Shouldn't there be something like a 32 bit wide char that can hold codepoints higher than 0xFFFF? 是否不应该有像32位宽的char这样的东西可以容纳高于0xFFFF的代码点?

Perhaps. 也许。 But Windows support for outputting glyphs outside the base multilingual plane is based on UTF-16. 但是Windows支持在基本多语言平面外部输出字形是基于UTF-16。 Split into a high and low surrogate pair and pass as if it were two characters. 分为上下两个代理对,并像两个字符一样通过。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM