Re: verifying unicode locale support

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: verifying unicode locale support
Дата
Msg-id 23711.1081873937@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: verifying unicode locale support  (Holger Klawitter <lists@klawitter.de>)
Ответы Re: verifying unicode locale support  (Karel Zak <zakkr@zf.jcu.cz>)
Список pgsql-general
Holger Klawitter <lists@klawitter.de> writes:
> In order to avoid interaction with gcc, cat and others else I've written a
> new program, reading from a file.

After setting up the test case and duplicating your problem, I realized
I was being dense :-( ... this is a well-known issue.  Need more
caffeine before answering bug reports obviously ...

The problem is that PG's upper() and lower() functions are based on
the C library's <ctype.h> functions (toupper() and tolower()), which of
course only work for single-byte character sets.  So they cannot work on
UTF8 data.

There has been some talk of rewriting these functions to use the
<wctype.h> API where available, but no one's actually stepped up to the
plate and done it.  IIRC the main sticking point was figuring out how to
get from whatever character encoding the database is using into the wide
character set representation the C library wants.  There doesn't seem to
be a portable way of discovering exactly what the wchar encoding is
supposed to be for the current locale setting.

If you're interested in trying to fix this, check the pgsql-hackers
archives for the previous discussions.  Searching for "wctype" would
probably find the relevant threads.

If you just want to get your work done, I'd suggest adopting a
single-byte encoding such as Latin1 for the database.

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: Holger Klawitter
Дата:
Сообщение: Re: verifying unicode locale support
Следующее
От: Christopher Petrilli
Дата:
Сообщение: Re: Filesystem vs. Postgres for images