Re: Remaining dependency on setlocale()

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Remaining dependency on setlocale()
Date: 2025-07-09 23:53:02
Message-ID: CA+hUKGLYcbnHBXhHk_OFwZ03LE+D=cAirm7TVN8fMhT9rgcTbA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jul 10, 2025 at 10:52 AM Jeff Davis <pgsql(at)j-davis(dot)com> wrote:
> The first problem -- how to affect the encoding of strings returned by
> strerror() on windows -- may be solvable as well. It looks like
> LC_MESSAGES is not supported at all on windows, so the only thing to be
> concerned about is the encoding, which is affected by LC_CTYPE. But
> windows doesn't offer uselocale() or strerror_l(). The only way seems
> to be to call _configthreadlocale(_ENABLE_PER_THREAD_LOCALE) and then
> setlocale(LC_CTYPE, datctype) right before strerror(), and switch it
> back to "C" right afterward. Comments welcome.

FWIW there is an example of that in src/port/pg_localeconv_r.c.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Champion 2025-07-09 23:54:02 Re: [PoC] Federated Authn/z with OAUTHBEARER
Previous Message Andres Freund 2025-07-09 23:34:21 Re: Some ExecSeqScan optimizations