c# how to output Unicode characters?

夙愿已清 提交于 2019-12-25 08:47:49

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/40364627/c-sharp-how-to-output-unicode-characters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!