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

From: "Enke, Michael" <michael(dot)enke(at)wincor-nixdorf(dot)com>
To: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Bug #659: lower()/upper() bug on ->multibyte<- DB
Date: 2002-05-08 14:54:55
Message-ID: 3CD93C3F.5CCDEA55@wincor-nixdorf.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Tatsuo Ishii wrote:
> > 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.

Excuse me, this seems not the be the source of the problem.
If I call select lower(table_col) from table;
then I also don't get back the lower case character but the original case if it is a multibyte char.
There I have no input from the client to the backend.
I did now also remove all below data directory, exported LC_CTYPE to de_DE.utf8, made an initdb.
With pg_controldata I see LC_CTYPE is de_DE.utf8
Now I no longer get the ERROR: cannot convert UTF-8 to ISO8859-1, but the translation doesn't work:
MB chars are not translated, I get back the original case.
BTW: mbsrtowcs(), wctrans(), towctrans(), wcsrtombs() makes the job with de_DE.utf8.

> Oops. That should be:
>
> select convert(lower(convert('X', 'LATIN1')),'LATIN1','UNICODE');
> It looks ugly, but works.

Sorry, it doesn't work. The same here, I get back the case I put in at X, not the lower case.

Regards,
Michael

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tatsuo Ishii 2002-05-09 01:06:13 Re: Bug #659: lower()/upper() bug on ->multibyte<- DB
Previous Message Joel Burton 2002-05-08 14:33:27 Re: Bug #661: Update to previous bug report

Browse pgsql-hackers by date

  From Date Subject
Next Message Manfred Koizar 2002-05-08 15:29:38 Re: Number of attributes in HeapTupleHeader
Previous Message Joel Burton 2002-05-08 14:42:07 Re: How much work is a native Windows application?