I wrote:
> I therefore propose the following idea: if the database encoding is
> UTF8, allow the regc_locale.c functions to call the <wctype.h>
> functions, assuming that wchar_t and pg_wchar_t share the same
> representation. On platforms where wchar_t is only 16 bits, we can do
> this up to U+FFFF and be stupid about code points above that.
Or to be concrete, how about the attached? It seems to do what's
wanted, but I'm hardly the best-qualified person to test it.
regards, tom lane