c# unicode string output

Posted by Reg on Stack Overflow See other posts from Stack Overflow or by Reg
Published on 2011-02-20T06:43:17Z Indexed on 2011/02/20 7:25 UTC
Read the original article Hit count: 132

Filed under:
|
|

I have function to convert string to a Unicode string:

        private string UnicodeString(string text)
        { 
            return Encoding.UTF8.GetString(Encoding.ASCII.GetBytes(text));
        }

But when I am calling this function the output result is wrong. It looks like my function is not working.

Console.WriteLine(UnicodeString("????? ?????")) printing on console just questions like that: ????? ????

Is there any way to say to console to display it correct?

UPDATE

Looks like the problem not in Unicode, I think may be it is displaying question marks because i am not having correct locale in the system (Windows 7)?

Is there any way to make it work without changing locale?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about unicode