Re: console output in 8.4.12 on windows
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.tcl archive

Re: console output in 8.4.12 on windows

From: David Gravereaux <davygrvy@pobox.com>
Date: Fri Dec 30 2005 - 05:30:12 CET

Benjamin Riefenstahl wrote:
> Hi David,
>
>
> David Gravereaux writes:
>
>>static BOOL
>>writeConsoleBytes(
>>[...]
>> sscanf(Tcl_DStringValue(&dstr), "cp%d", &codepage);
>
>
> This should do error checking, in case the programmer has set
> something like Latin-9, thinking s/he is on Unix.

Thanks for reading it. I only presented the code as an idea.

>
>> SetConsoleCP(codepage);
>
>
> This is unnecessary.

It _is_ needed as the channel encoding works in both directions.

  SetConsoleCP() is only for input. You want to
> use SetConsoleCP() for reading the console and SetConsoleOutputCP()
> for writing.
>
>
>> SetConsoleOutputCP(codepage);
>
>
>
> benny
Received on Tue Jan 3 03:09:44 2006