Re: [PATCHES] WIN32_CONSOLE usage

From: Christoph Dalitz <christoph(dot)dalitz(at)hs-niederrhein(dot)de>
To: Manfred Spraul <manfred(at)colorfullife(dot)com>
Cc: pgman(at)candle(dot)pha(dot)pa(dot)us, peter_e(at)gmx(dot)net, pgsql-patches(at)postgresql(dot)org, pgsql-hackers-win32(at)postgresql(dot)org, pgsql-cygwin(at)postgresql(dot)org
Subject: Re: [PATCHES] WIN32_CONSOLE usage
Date: 2003-09-08 10:27:05
Message-ID: 20030908122705.6f9a2dcd.christoph.dalitz@hs-niederrhein.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-cygwin pgsql-hackers-win32 pgsql-patches

On Sun, 07 Sep 2003 20:37:08 +0200
Manfred Spraul <manfred(at)colorfullife(dot)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

In response to

Responses

Browse pgsql-cygwin by date

  From Date Subject
Next Message raj_14_11 2003-09-08 11:16:48 Re: cygrunsrv -S postmaster giving error
Previous Message raj_14_11 2003-09-08 10:23:50 cygrunsrv -S postmaster giving error

Browse pgsql-hackers-win32 by date

  From Date Subject
Next Message Darko Prenosil 2003-09-08 11:12:45 Re: [pgsql-hackers-win32] Windows CHM format for the documents
Previous Message Andreas Pflug 2003-09-08 10:05:43 Re: [pgsql-hackers-win32] Windows CHM format for the documents

Browse pgsql-patches by date

  From Date Subject
Next Message Andreas Pflug 2003-09-08 10:52:26 Re: Unixware 713 probs
Previous Message Gaetano Mendola 2003-09-08 09:33:52 Re: mcxt.c