mirror of
https://github.com/postgres/postgres.git
synced 2025-09-06 13:46:51 +03:00
These functions should take a pg_locale_t, not a collation OID, and should call mbstowcs_l/wcstombs_l where available. Where those functions are not available, temporarily select the correct locale with uselocale(). This change removes the bogus assumption that all locales selectable in a given database have the same wide-character conversion method; in particular, the collate.linux.utf8 regression test now passes with LC_CTYPE=C, so long as the database encoding is UTF8. I decided to move the char2wchar/wchar2char functions out of mbutils.c and into pg_locale.c, because they work on wchar_t not pg_wchar_t and thus don't really belong with the mbutils.c functions. Keeping them where they were would have required importing pg_locale_t into pg_wchar.h somehow, which did not seem like a good plan.
src/backend/utils/mb/README Encodings ========= encnames.c: public functions for both the backend and the frontend. conv.c: static functions and a public table for code conversion wchar.c: mostly static functions and a public table for mb string and multibyte conversion mbutils.c: public functions for the backend only. requires conv.c and wchar.c wstrcmp.c: strcmp for mb wstrncmp.c: strncmp for mb win866.c: a tool to generate KOI8 <--> CP866 conversion table iso.c: a tool to generate KOI8 <--> ISO8859-5 conversion table win1251.c: a tool to generate KOI8 <--> CP1251 conversion table Introduction ------------ http://www.cprogramming.com/tutorial/unicode.html