Re: BUG #3737: lower/upper fails to match extended chars in LATIN1 - Mailing list pgsql-bugs

From Heikki Linnakangas
Subject Re: BUG #3737: lower/upper fails to match extended chars in LATIN1
Date
Msg-id 47348EA4.3050201@enterprisedb.com
Whole thread Raw
In response to BUG #3737: lower/upper fails to match extended chars in LATIN1  ("Jonas Forsman" <jonas@axier.org>)
Responses Re: BUG #3737: lower/upper fails to match extended chars in LATIN1  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-bugs
Jonas Forsman wrote:
> The following bug has been logged online:
>
> Bug reference:      3737
> Logged by:          Jonas Forsman
> Email address:      jonas@axier.org
> PostgreSQL version: 8.1.10
> Operating system:   Ubuntu 6.06 LTS
> Description:        lower/upper fails to match extended chars in  LATIN1
> Details:
>
> Try:
> select * from table where lower(address) like '%Ã¥%'
>
> This select fails to find addresses including capital Å and similars in
> LATIN1 (like Å, Ä, Ö).

The behavior of lower() depends on your locale. What locale are you
running in? Make sure your locale matches the encoding.

Exact locale names and behavior are defined by the operating system, but
for example on Debian, which is probably the same as Ubuntu in this
case, use

initdb -D data --locale=sv_SE.iso88591 --encoding=LATIN1

for Swedish.

Also make sure that your client_encoding is set correctly. For example,
if you run the query in psql in a terminal that uses UTF-8 encoding, you
need to "SET client_encoding='UTF-8'"

See the manual for more details:
http://www.postgresql.org/docs/8.1/static/charset.html#LOCALE

--
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

pgsql-bugs by date:

Previous
From: "Chris Vickery"
Date:
Subject: BUG #3738: psql crashes on exit.
Next
From: Douglas Toltzman
Date:
Subject: Re: BUG #3736: server cannot listen