On Sat, Aug 3, 2024 at 2:11 AM David E. Wheeler <da...@justatheory.com> wrote: > Haven’t been following this thread, but this post reminded me of an issue I > saw with locales on Windows[1]. Could it be that the introduction of > Universal CRT[2] in Windows 10 has improved UTF-8 support?
Yeah. We have a few places that claim that Windows APIs can't do UTF-8 and they have to do extra wchar_t conversions, but that doesn't seem to be true on modern Windows. Example: https://github.com/postgres/postgres/blob/7926a9a80f6daf0fcc1feb1bee5c51fd001bc173/src/backend/utils/adt/pg_locale.c#L1814 I suspect that at least when the locale name is "en-US.UTF-8", then the regular POSIXoid strcoll_l() function should just work™ and we could delete all that stuff and save Windows users a lot of wasted CPU cycles.