Hmm well the KOI8 tests unsurprisingly produce random results on non-KOI8 input. It's pure chance you didn't get EILSEQ.
Because KOI8 is not multibyte encoding.
What errno did you get for the C locale test? On which input character?Perhaps it's sihnalljng EILSEQ for every byte >0x80 ? That seems broken to me but perhaps not to a glibc pedant out there.
Linux ========C==========mbstowcs returns -1 errno: 84 Invalid or incomplete multibyte or wide character
========ru_RU.KOI8-R========== mbstowcs returns 12 errno: 0 Success ========ru_RU.UTF-8========== mbstowcs returns 6 errno: 0 Success FreeBSD ========C========== mbstowcs returns 12 errno: 0 Unknown error: 0 ========ru_RU.KOI8-R========== mbstowcs returns 12 errno: 0 Unknown error: 0 ========ru_RU.UTF-8========== mbstowcs returns 6 errno: 0 Unknown error: 0In any case, we could not trust mbstowcs if current locale is not match to encoding. And we could not check every pair of locale/encoding but mbstowcs with C-locale and multibyte encoding obviously doesn't work.
t-1.c.gz
Description: application/gzip
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers