Re: Bug #659: lower()/upper() bug on ->multibyte<- DB

From: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
To: michael(dot)enke(at)wincor-nixdorf(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Bug #659: lower()/upper() bug on ->multibyte<- DB
Date: 2002-05-08 12:30:01
Message-ID: 20020508213001S.t-ishii@sra.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

> > 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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Joel Burton 2002-05-08 14:33:27 Re: Bug #661: Update to previous bug report
Previous Message Enke, Michael 2002-05-08 09:15:07 Re: Bug #659: lower()/upper() bug on ->multibyte<- DB

Browse pgsql-hackers by date

  From Date Subject
Next Message mlw 2002-05-08 12:35:20 Path to PostgreSQL portabiliy
Previous Message Marc G. Fournier 2002-05-08 12:28:38 Re: How much work is a native Windows application?