Re: Bug #659: lower()/upper() bug on ->multibyte<- DB
| От | Tatsuo Ishii |
|---|---|
| Тема | Re: Bug #659: lower()/upper() bug on ->multibyte<- DB |
| Дата | |
| Msg-id | 20020508213001S.t-ishii@sra.co.jp обсуждение исходный текст |
| Ответ на | Bug #659: lower()/upper() bug on ->multibyte<- DB (pgsql-bugs@postgresql.org) |
| Список | pgsql-bugs |
> > This is not a bug but an expected behavior. Locale support expects an
> > input string is encoded in ISO-8859-1 (because you set locale to
> > de_DE) while you supply UTF-8.
>
> What is the difference between an insert of string and a call to a function with a string argument?
You input "select lower('X')" as ISO-8859-1 encoded, then it is sent
to the backend. The backend convert it to UTF-8. Then lower() is
called with an UTF-8 string input. lower() calls tolower() which
expects the input being ISO-8859-1 since you set locale to de_DE.
This is the source of the problem.
> > select lower(convert('D'), 'LATIN1');
>
> I tried: select lower(convert('X'), 'LATIN1'); -- X is german umlaut A, capital
> but the result was the same:
> ERROR: Could not convert UTF-8 to ISO8859-1
Oops. That should be:
select convert(lower(convert('X', 'LATIN1')),'LATIN1','UNICODE');
It looks ugly, but works.
--
Tatsuo Ishii
В списке pgsql-bugs по дате отправления: