Artúr Bella
Artúr Bella

Reputation: 58

c# how to output Unicode characters?

I have int values stored in a list, that I want to output as unicode characters, like this:

 //A List<int> named Kanji exists and has values
    Console.OutputEncoding = Encoding.Unicode;
    int i = 0;
    while (i < Kanji.Count)
    {
        Console.WriteLine((char)Kanji[i]);
        i++;
    }

But this only returns ? characters. What should I do? The int values themselves are fine, I tested them.

Upvotes: 0

Views: 1337

Answers (1)

Lucero
Lucero

Reputation: 60190

The console is probably not using a Unicode or Japanese encoding, and/or the font used does not contain the required character glyphs.

Have a look at Console.OutputEncoding for more information, and the Unicode Support for the Console section.

Upvotes: 1

Related Questions