brighty
brighty

Reputation: 402

How to print a character above 0xFFFF?

I wonder if it is possible to print a character above 0xFFFF with Windows?

I am using Microsoft Visual Studio 2010 along with Windows XP. A character is 16 bits wide so codepoints greater than 0xFFFF cannot really fit into a single 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.

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, E.G., have no codepoint by themselves, only as a pair, instead of the "real" character.

Shouldn't there be something like a 32-bit wide character that can hold codepoints higher than 0xFFFF?

Upvotes: 0

Views: 805

Answers (1)

Richard
Richard

Reputation: 108985

Shouldn't there be something like a 32 bit wide char that can hold codepoints higher than 0xFFFF?

Perhaps. But Windows support for outputting glyphs outside the base multilingual plane is based on UTF-16. Split into a high and low surrogate pair and pass as if it were two characters.

Upvotes: 5

Related Questions