質問

I'm making a text-mode game and apparently I've got some problems in displaying some of crucial characters in C#. They come from code page CP437, but even if I set code page to 437:

Console.OutputEncoding = Encoding.GetEncoding(437);

The only thing I see when I try to print characters I need is "????" (some question marks), as if Visual Studio's console was unable to print them. These characters I need are 0xB0, 0xB1, 0xB2, 0xDB.

BTW, I printed all of 256 characters in this encoding and I see that there are far more characters displayed as "?".

TIA.

役に立ちましたか?

解決

The default code page for the console already is 437. The most likely failure mode is actually trying to write 0xb0, etc instead of the Unicode version of those characters. Which will indeed cause a lot of question marks, many code points in the range U+0080 to U+00ff are unassigned or don't have a corresponding character in page 437.

0xb0 in code page 437 is '\u2591' in your C# code. Check this page for codes.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top