I'm trying to ask for input from the console in Hebrew and then compare it to a premade table. Problem is for some reason the text from the console and what i typed in the code aren't the same.
through testing i found that with the following code, if i type א in console, it returns no. Why does it do this and how do i fix it?
string t = Console.ReadLine();
if (t == "א")
{
Console.WriteLine("yes");
}
else { Console.WriteLine("no"); }
CodePudding user response:
using System.Text;
Console.InputEncoding = Encoding.Unicode;
Console.OutputEncoding = Encoding.Unicode;
string t = Console.ReadLine();
if (t == "א")
{
Console.WriteLine("yes");
}
else
{
Console.WriteLine("no");
}
Worked for me copy/pasting א in.