Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to write Hebrew in the Windows Console?

Is there any way to write Hebrew in the Windows Console?

I tried the following:

Console.OutputEncoding = new UTF8Encoding(false);
Console.WriteLine("\u05D0\u05D1");
Console.ReadLine();

but instead of "אב" it writes some other Unicode character, that're not in the Hebrew ABC.

Any ideas why?

like image 650
Alon Gubkin Avatar asked Feb 06 '10 15:02

Alon Gubkin


3 Answers

Simply change the OutputEncoding:

Console.OutputEncoding = Encoding.GetEncoding("Windows-1255");
like image 52
N T Avatar answered Sep 27 '22 02:09

N T


If you can call chcp command before your program, you can change the codepage to Hebrew and then your characters will be readable. There is an interesting article about internationalization and windows console here: http://illegalargumentexception.blogspot.com/2009/04/i18n-unicode-at-windows-command-prompt.html

like image 34
naivists Avatar answered Sep 26 '22 02:09

naivists


        Console.OutputEncoding = new UTF8Encoding();
        Console.WriteLine("\u05D0\u05D1");
        Console.WriteLine("אריאל");
        Console.WriteLine(new string("אריאל".Reverse().ToArray()));

works for me, maybe is just about removing the "false"? this is working in my machine, except o.c. it writes the letters backwards, unless i use reverse

maybe you need to set the registry? run -> regedit and do this: http://blogs.microsoft.co.il/technet/2013/06/11/%D7%90%D7%99%D7%9A-%D7%90%D7%A4%D7%A9%D7%A8-%D7%9C%D7%A8%D7%90%D7%95%D7%AA-%D7%A2%D7%91%D7%A8%D7%99%D7%AA-%D7%91-powershell-console/

in the registry window rightclick choose new string.

like image 34
bresleveloper Avatar answered Sep 23 '22 02:09

bresleveloper