From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | pgsql-hackers-win32 <pgsql-hackers-win32(at)postgresql(dot)org> |
Cc: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Subject: | more setlocale fun |
Date: | 2003-10-10 14:31:32 |
Message-ID: | 3F86C2C4.7020209@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers-win32 |
backend/main/main.c contains this code:
/*
* Set up locale information from environment. Note that LC_CTYPE and
* LC_COLLATE will be overridden later from pg_control if we are in an
* already-initialized database. We set them here so that they will
* be available to fill pg_control during initdb. LC_MESSAGES will get
* set later during GUC option processing, but we set it here to allow
* startup error messages to be localized.
*/
setlocale(LC_COLLATE, "");
setlocale(LC_CTYPE, "");
#ifdef LC_MESSAGES
setlocale(LC_MESSAGES, "");
#endif
Unfortunately, on Windows this won't have the desired effect, as
setlocale(category,"") apparently does not read from the environment,
which we will have been careful to set up in initdb - it reads from the
current codepage settings, it seems.
On Windows we'll have to do something like this, I think:
char * loc;
if ((loc = getenv("LC_CTYPE") != NULL)
setlocale(LC_CTYPE,loc);
else
setlocale(LC_CTYPE,"");
...
(cygwin behaves "correctly", though)
cheers
andrew
From | Date | Subject | |
---|---|---|---|
Next Message | Merlin Moncure | 2003-10-10 17:08:46 | Re: signals on windows |
Previous Message | Andrew Dunstan | 2003-10-10 11:50:06 | Re: [HACKERS] initdb |