On Thu, Jul 10, 2025 at 10:52 AM Jeff Davis <pgsql@j-davis.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.