[Mono-list] Re: Default Encoding for Console.In/Out/Err

Alan Tam Tam@SiuLung.com
Wed, 22 Jan 2003 18:09:22 +0800


Thank you. This time I do the same thing as I did but it worked. Strange.
Maybe I did have a typo.

However, I found this way of setting the environment variable inconvenient.
I hope I could do it like this:

Console.SetOut(new StreamWriter(Console.OpenStandardError(),
Encoding.Default));

However, after the statement, all Console.Write() has gone somewhere else
instead of the orginal stdout. Do you know why?

Regards,
Alan

----- Original Message -----
From: "Alan Tam" <Tam@SiuLung.com>
To: <mono-list@ximian.com>
Sent: 20030122 03:30
Subject: Default Encoding for Console.In/Out/Err


> Dear All,
>
> I am experiencing problem when the TextWriter in Console all have encoding
> System.Text.ASCIIEncoding.
>
> I traced into the source and found that it is from
> Encoding.UnixConsoleEncoding, which is built from Encoding.Default and in
> turn from here:
>
>         [MethodImpl (MethodImplOptions.InternalCall)]
>         extern private static string InternalCodePage ();
>
> Is it something like a native method in Java? Where can I find the source
> code?
>
> Or does anyone know how I can manipulate the default value? It seems the
> LANG and LC_* environment variables do not help.
>
> Thanks!
>
> Regards,
> Alan
>