Re: BUG #3378: UTF-8 upper() and lower() don't work

From: "Thomas H(dot)" <me(at)alternize(dot)com>
To: Kenneth Christensen <kec(at)mediatorsystems(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #3378: UTF-8 upper() and lower() don't work
Date: 2007-06-11 11:09:49
Message-ID: 466D2D7D.4010508@alternize.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

hi kenneth

these special characters work fine here:

select lower('ÆØÅ'), upper('æøå'), lower('Æble, tørret'), upper('Æble,
tørret');

result: æøå ÆØÅ æble, tørret ÆBLE, TØRRET

as pavel hinted, you probably aren't using the proper locale settings

cheers,
thomas

-------- Original Message --------
Subject: Re:[BUGS] BUG #3378: UTF-8 upper() and lower() don't work
From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Kenneth Christensen <kec(at)mediatorsystems(dot)com>
Date: 10.06.2007 15:36

> Hello,
>
> You have to well initialized database cluster with correct locales.
>
> I don't know good danish locales, but I expect so it will be similar
> with czech.
>
> my database cluster was initialised with cs_CZ.UTF-8 and default
> encoding is UTF8.
>
>
> postgres=# select lower('ŽLUTÝ KŮŇ'), upper('žlutý kůň');
> lower | upper
> -----------+-----------
> žlutý kůň | ŽLUTÝ KŮŇ
>
>
> Check your locales, if is UTF8.
>
> postgres=# SHOW lc_collate ;
> lc_collate
> -------------
> cs_CZ.UTF-8
> (1 row)
>
> Regars
> Pavel Stehule
>
>
> 2007/6/10, Kenneth Christensen <kec(at)mediatorsystems(dot)com>:
>>
>> The following bug has been logged online:
>>
>> Bug reference: 3378
>> Logged by: Kenneth Christensen
>> Email address: kec(at)mediatorsystems(dot)com
>> PostgreSQL version: 8.2
>> Operating system: Mac OS 10.4.9
>> Description: UTF-8 upper() and lower() don't work
>> Details:
>>
>> I have a DB where encoding is set to UTF-8.
>>
>> The DB have some tables where some of the columns (varchar) contains
>> danish
>> chars.
>>
>> It looks like lower() and upper() ignores the danish chars when I try to
>> convert to lowercase or uppercase.
>>
>> E.g.
>>
>> Case 1:
>> -------
>>
>> Column 'name' contains 'Æble, tørret':
>>
>> select upper(food_name.name) from food_name
>>
>> Result: ÆBLE, TøRRET
>> Expected result: ÆBLE, TØRRET
>>
>> or
>>
>> select lower(food_name.name) from food_name
>>
>> Result: Æble, tørret
>> Expected result: æble, tørret
>>
>> Case 2:
>> -------
>>
>> Column 'name' contains 'æøå':
>>
>> select upper(food_name.name) from food_name
>>
>> Result: æøå
>> Expected result: ÆØÅ
>>
>> Case 3:
>> -------
>>
>> Column 'name' contains 'ÆØÅ':
>>
>> select lower(food_name.name) from food_name
>>
>> Result: ÆØÅ
>> Expected result: æøå
>>
>> ---
>>
>> I can see I'm not alone with this kind of bug. This bug is really a big
>> problem for me.
>>
>> I really don't want to replace PostgreSQL with MySQL !
>> Will this bug be fixed very soon?
>>
>> Best regards
>>
>> Kenneth Christensen
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 9: In versions below 8.0, the planner will ignore your desire to
>> choose an index scan if your joining column's datatypes do not
>> match
>>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Ujo Jozef 2007-06-11 15:33:17 BUG #3381: Bad sort order for UTF-8 texts on sk_SK.UTF-8 locale on 8.2.4
Previous Message Pavel Stehule 2007-06-10 13:36:15 Re: BUG #3378: UTF-8 upper() and lower() don't work