Re: Like with special character

From: Osvaldo Kussama <osvaldo_kussama(at)yahoo(dot)com(dot)br>
To: emilu(at)encs(dot)concordia(dot)ca, pgsql-sql(at)postgresql(dot)org
Subject: Re: Like with special character
Date: 2006-07-18 19:05:50
Message-ID: 20060718190550.24947.qmail@web60824.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


Emi Lu <emilu(at)encs(dot)concordia(dot)ca> escreveu:
>
>
>> I'm using postGre with tables which contain French character
>> (?????...). Is there a fonction which performs a like in replacing ?
>> (e cute) by e ?
>
> to_ascii() should helps you

I got the following error:

select to_ascii('ê');
ERROR: encoding conversion from UNICODE to ASCII not supported

Some comments about it.

From the docs:
http://www.postgresql.org/docs/8.1/interactive/functions-string.html#FTN.AEN7612

Notes on table 9-6. Other String Functions:
"The to_ascii function supports conversion from LATIN1, LATIN2, LATIN9, and WIN1250 encodings only. "

Try convert encoding:

bdteste=# \set
VERSION = 'PostgreSQL 8.1.4 on i386-redhat-linux-gnu, compiled by GCC i386-redhat-linux-gcc (GCC) 4.1.0 20060304 (Red Hat 4.1.0-3)'
....
ENCODING = 'UTF8'
......

bdteste=# select to_ascii('ê');
ERRO: conversão de condificação de UTF8 para ASCII não é suportada

bdteste=# select to_ascii('ê','LATIN1');
to_ascii
----------
Aa
(1 registro)

bdteste=# SELECT convert('ê', 'UTF8', 'LATIN1');
convert
---------

(1 registro)

bdteste=# SELECT to_ascii(convert('ê', 'UTF8', 'LATIN1'));
ERRO: conversão de condificação de UTF8 para ASCII não é suportada

bdteste=# SELECT to_ascii(convert('ê', 'UTF8', 'LATIN1'), 'LATIN1');
to_ascii
----------
e
(1 registro)

[]s
Osvaldo


---------------------------------
O Yahoo! está de cara nova. Venha conferir!

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Andrew Hammond 2006-07-18 20:44:28 Re: [SQL] using constraint based paritioning to fix EAV type schemas? (view inheritance and constraints)
Previous Message Curtis Scheer 2006-07-18 18:37:35 Re: How to pass array of values to a stored procedure