Problems with input when writing other languages in C#

3202 views c#
2

class Exercise
{
    static void Main(string[] args)
    {
        String a = Console.ReadLine();
        int b = int.Parse(a);

        if (b % 2 == 0)
        {
            Console.WriteLine("??????? ? ? ?????" );
        }
        else
        {
            Console.WriteLine("??????? ? ???????");

        }
    }
}

I am unable to enter text in my own languages. Is there a way to import a library or something that can read letters appart from English ones? See the input of the screenshot.

UTF-8 format uses that Cyrillic alphabet.

screenshot

answered question

Console is the Windows command line, which does not use Unicode. You should make a UWP or other GUI application.

1 Answer

5

I found it ! Sorry for the spam! I have to add this line to my code.

Console.OutputEncoding = Encoding.UTF8;

posted this

Have an answer?

JD

Please login first before posting an answer.