Reputation: 31
I'm trying to output θ (theta) on a console applicatation and I searched on Google and found that I have to use Unicode to output any greek symbols. So the code I used was:
Console.WriteLine("\u03B8 (deg) R (m) \t T (kN) FOS");
But instead of printing 'θ', '?' is printed. Can somebody advise me please?
Upvotes: 3
Views: 3444
Reputation: 25705
See How to make Unicode charset in cmd.exe by default?
The answers to this question explain how to set up cmd.exe
to display Unicode characters.
Specifically, this answer suggests changing the registry:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage]
OEMCP
value to 65001
Upvotes: 2
Reputation: 1813
If you're outputting to the console, you'll have to change your codepage to something that understands unicode. You can do this by typing chcp 65001
at a command prompt. You'll also have to change your font to Lucida Console or Consolas:
Edit: Well of course it's possible to do in C# as well:
public static void Main()
{
Console.OutputEncoding = System.Text.Encoding.Unicode;
Console.WriteLine("\u03B8");
Console.ReadLine();
}
I think you'll still have to massage the font by hand (or by unmanaged code).
Upvotes: 4