Re: WIN32_CONSOLE usage - Mailing list pgsql-patches

From Christoph Dalitz
Subject Re: WIN32_CONSOLE usage
Date
Msg-id 20030908122705.6f9a2dcd.christoph.dalitz@hs-niederrhein.de
Whole thread Raw
In response to Re: WIN32_CONSOLE usage  (Manfred Spraul <manfred@colorfullife.com>)
Responses Re: WIN32_CONSOLE usage
List pgsql-patches
On Sun, 07 Sep 2003 20:37:08 +0200
Manfred Spraul <manfred@colorfullife.com> wrote:
>
> >>I think we ought to detect the console type automatically anyway.
> >>Certainly we don't want people to have to set this variables all the time.
> >>
> Does input from the console work correctly right now?
>
> What about setting the code page of the console to the ansi code page?
> Or to the code page that postgresql uses internally.
>
>     SetConsoleCP(GetACP());
>     SetConsoleOutputCP(GetACP());
>
> might be sufficient.
>
Shame on me!

Manfred's suggestion works perfectly. I did not realize this because the default
"rasterfont" for the win32 console cannot be used with codepage 1252 (windows
codepage on my system). When I switch to the font "Lucida Console" however, all
is fine with codepage 1252.

I have found this soultion here:
http://www.bei-priess.de/Perliges/perl-sonder.htm

Actually no psql tweaks are necessary at all, because the codepage for a console window
can be set with "cmd.exe /c chcp 1252". When I put this in my .bashrc, I actuallay
can use umlauts.

Sorry for producing some inconviniences in the psql devellopment.

The easiest would be to withdraw the WIN32_CONSOLE stuff from psql, replace it with
Manfred's solution and add to the documentation a tutorial how to make 8-bit characters
work in the Win32 console (with Manfred's solution, it actually only requires to set
the console font to "Lucida Console"). Alternatively no tweaks to psql could be done,
and the documentation should describe how the console can be forced to use the proper
encoding (this is certainly of interest to all win32 users of other applictaions as
well).

Christoph Dalitz


pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: about contrib/dbase/dbf.c (fwd): conversion of non-ascii
Next
From: Bruce Momjian
Date:
Subject: Re: 7.4beta2 initdb Fix