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, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Bug #659: lower()/upper() bug on ->multibyte<- DB
Date: 2002-05-08 03:09:47
Message-ID: 20020508120947C.t-ishii@sra.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

> Short Description
> lower()/upper() bug on ->multibyte<- DB
>
> Long Description
> OS: Linux Kernel 2.4.4, PostgreSQL version 7.2.1
> lower() and upper() doesn't work like expected for multibyte
> databases. It is working fine for one-byte encoding.
> The behaviour can be reproduced as follows:
> at initdb: LC_CTYPE was set to de_DE
> createdb -E UTF-8 name
> export PGCLIENTENCODING=LATIN1
> psql -U name
> --------------------------------------------------
> => select lower('D'); -- german umlaut A, capital
> ERROR: Could not convert UTF-8 to ISO8859-1
> -- I expected to see: d german umlaut a, lower case

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. Try an explicit encoding converion
function:

select lower(convert('D'), 'LATIN1');

Note that '\304' must be an actual german umlaut A, capital character,
not an octal espcaped notion.
--
Tatsuo Ishii

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message pgsql-bugs 2002-05-08 03:39:02 Bug #660: View name not stored in lowercase
Previous Message Stephan Szabo 2002-05-07 15:55:48 Re: problem with the sum function

Browse pgsql-hackers by date

  From Date Subject
Next Message Lee, Shawn 2002-05-08 03:11:15 Creating new system catalog
Previous Message Ryan Bradetich 2002-05-08 02:35:50 Re: a couple of minor itches: RI Trigger Names, and