I have added a font to cmd. (DejaVu Sans Mono) This techrepublic link has the registry hack to add a font to cmd, one can do it for some fonts such as that one.
The font has a unicode non ascii glyph and I can paste that unicode non ascii glyph into the cmd prompt
But my C# program that reads from stdin, is not outputting it
Here is my C# program and its output
My program reads a line from stdin, and writes it.
The problem is that when it writes it, it writes a question mark
The program even has this line
Console.OutputEncoding = System.Text.Encoding.Unicode;
but even with that line it isn't making it output the character
C:\blah>echo ⬕
⬕
C:\blah>type b1.cs
using System;
class Program
{
static void Main(string[] args)
{
Console.OutputEncoding = System.Text.Encoding.Unicode;
string s;
s = Console.ReadLine();
Console.WriteLine(s);
}
}
C:\blah>b1
⬕
?
C:\blah>
I know I am in good company, because more
has the same problem.. but echo can do it, so I should be able to make my program do it
C:\blah>echo ⬕
⬕
C:\blah>more
⬕
?
^C
C:\blah>
added screenshot re cyril's comment
added screenshot re .. comment
A C# program with one line Console.WriteLine("⬕")
writes ?
It is saved as unicode to preserve that character, and it compiles. But given that it prints a ?, it seems the corruption occurs on output. I can't quite comment on whether corruption also occurs on stdin too. But it looks like it occurs on output.
You need to set input encoding as well.
Updated!