encoding problem

Started by marcelo Cortezover 20 years ago4 messagesgeneral
Jump to latest
#1marcelo Cortez
jmdc_marcelo@yahoo.com.ar

folks

i have problems with encodings
the scenario is:

database: CREATE DATABASE "testLatin"
WITH OWNER = owner1
ENCODING = 'LATIN9';
test table:

CREATE TABLE test
( nombre varchar(20))
WITH OIDS;
ALTER TABLE test OWNER TO marcelo;
data:
nombre
---------
"maric�n"
"�a�oso p�caro"

test statement
select * from test where upper(nombre) like '�A%'
not data found !!!

any ideas?
best regards

MDC

pd: Unicode encoding has same result.

___________________________________________________________
1GB gratis, Antivirus y Antispam
Correo Yahoo!, el mejor correo web del mundo
http://correo.yahoo.com.ar

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: marcelo Cortez (#1)
Re: encoding problem

marcelo Cortez <jmdc_marcelo@yahoo.com.ar> writes:

i have problems with encodings

You need to make sure that the database locale matches what you want,
not only the encoding.

See the "Localization" chapter in the docs:
http://www.postgresql.org/docs/8.1/static/charset.html

regards, tom lane

#3marcelo Cortez
jmdc_marcelo@yahoo.com.ar
In reply to: Tom Lane (#2)
Re: encoding problem
 --- Tom Lane <tgl@sss.pgh.pa.us> escribi�:

marcelo Cortez <jmdc_marcelo@yahoo.com.ar> writes:

i have problems with encodings

You need to make sure that the database locale
matches what you want,
not only the encoding.

See the "Localization" chapter in the docs:

http://www.postgresql.org/docs/8.1/static/charset.html

regards, tom lane

---------------------------(end of
broadcast)---------------------------
TIP 5: don't forget to increase your free space map
settings

___________________________________________________________
1GB gratis, Antivirus y Antispam
Correo Yahoo!, el mejor correo web del mundo
http://correo.yahoo.com.ar

#4Volkan YAZICI
volkan.yazici@gmail.com
In reply to: marcelo Cortez (#1)
Re: encoding problem

On 12/1/05, marcelo Cortez <jmdc_marcelo@yahoo.com.ar> wrote:

i have problems with encodings

PostgreSQL case conversion functions is a little bit buggy.
(Especially for Latin-N and Unicode encodings.) I've prepared a patch
[1]: You can find related patch (and discussion) @ http://archives.postgresql.org/pgsql-patches/2005-11/msg00173.php address. It fixes case conversion problems for ILIKE, upper() and lower() functions.
much but works for your problem too:

template1=# CREATE DATABASE "testLatin" ENCODING = 'LATIN9';
CREATE DATABASE
template1=# \c testLatin
You are now connected to database "testLatin".
testLatin=# CREATE TABLE test
testLatin-# ( nombre varchar(20));
CREATE TABLE
testLatin=# COPY test FROM stdin;
Enter data to be copied followed by a newline.
End with a backslash and a period on a line by itself.

maricón
ñañoso pícaro
\.

testLatin=# select * from test where upper(nombre) like 'ÑA%';
nombre
---------------
ñañoso pícaro
(1 row)

[1]: You can find related patch (and discussion) @ http://archives.postgresql.org/pgsql-patches/2005-11/msg00173.php address. It fixes case conversion problems for ILIKE, upper() and lower() functions.
http://archives.postgresql.org/pgsql-patches/2005-11/msg00173.php
address. It fixes case conversion problems for ILIKE, upper() and
lower() functions.

Regards.