Re: [pgsql-hackers-win32] Win32 & NLS

From: "Magnus Hagander" <mha(at)sollentuna(dot)net>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Peter Eisentraut" <peter_e(at)gmx(dot)net>, "pgsql-patches" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [pgsql-hackers-win32] Win32 & NLS
Date: 2004-10-17 19:37:08
Message-ID: 6BCB9D8A16AC4241919521715F4D8BCE475F19@algol.sollentuna.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

>> Test program attached, results below. It returns NULL for
>> whatever I try with LC_MESSAGES.
>
>It looks like LC_MESSAGES just plain does not work on Windows. I did
>some googling and found some pages suggesting this, for instance
>
>http://msdn.microsoft.com/library/default.asp?url=/library/en-u
> s/vclib/html/_crt_setlocale.2c_._wsetlocale.asp

Yes, that's exactly the link I had in my original mail.

> The patch you suggest looks remarkably ugly; in particular it is
> generally unsafe to pass a local variable to putenv. Perhaps that
> does not matter on Windows but I wonder whether the putenv part
couldn't
> just be dropped.

I got that from the gettext FAQ.
The problem is that MSVCRT caches the environment, and that's what you
access using getenv() and putenv(). And this is what gettext uses
internally. The API call is to change the actual process environment.
That's why you need both.

As for the dangers of passing a local variable - there is nothing abot
that in the putenv documentation on MSDN. So I would assume it's safe on
windows.

> And why bother with ZeroMemory?

Oops. that's a leftover from some previous hacking.

//Magnus

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2004-10-17 19:49:25 Re: strange result from contrib/seg regression on windows
Previous Message Andrew Dunstan 2004-10-17 19:35:10 strange result from contrib/seg regression on windows