Like with special character
Like with special character
От:
tnodev <tnodev@free.fr>
Дата:
Hello, I'm using postGre with tables which contain French character (éèçàù...). Is there a fonction which performs a like in replacing é (e cute) by e ? thanks...
Re: Like with special character
От:
Guillaume LELARGE <guillaume.lelarge@gmail.com>
Дата:
Hi,
tnodev a écrit :
> I'm using postGre with tables which contain French character (éèçàù...).
> Is there a fonction which performs a like in replacing é (e cute) by e ?
>
select translate('forêt', 'àâäéèêëîïôöùûü', 'aaaeeeeiioouuu');
Change the first word (forêt) by the string you want characters to be
replaced.
For more, see : http://docs.postgresqlfr.org/pgsql-8.1.3-fr/functions-string.html (french docs) http://www.postgresql.org/docs/8.1/interactive/functions-string.html (english docs)
BTW, it is PostgreSQL, not postGre.
Regards,
--
Guillaume.
Re: Like with special character
От:
Oleg Bartunov <oleg@sai.msu.su>
Дата:
On Mon, 1 May 2006, tnodev wrote: > Hello, > > 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 > > thanks... > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend > Regards, Oleg _____________________________________________________________ Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru), Sternberg Astronomical Institute, Moscow University, Russia Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(495)939-16-83, +007(495)939-23-83
Re: Like with special character
От:
TNO <tnodev@free.fr>
Дата:
Perfect, thanks I found regex for postgreSql too, it's interesting too select * from divers where s_libelle ~* '^t(e|é|ê)' Oleg Bartunov a écrit : > On Mon, 1 May 2006, tnodev wrote: > >> Hello, >> >> 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 > >> >> thanks... >> >> ---------------------------(end of broadcast)--------------------------- >> TIP 6: explain analyze is your friend >> > > Regards, > Oleg > _____________________________________________________________ > Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru), > Sternberg Astronomical Institute, Moscow University, Russia > Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ > phone: +007(495)939-16-83, +007(495)939-23-83 > > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster > > > -- Il n'y a pas de mauvais langage, il n'y a que des bons programmeurs
Re: Like with special character
От:
Emi Lu <emilu@encs.concordia.ca>
Дата:
>
>
>> 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.
Re: Like with special character
От:
Osvaldo Kussama <osvaldo_kussama@yahoo.com.br>
Дата:
Emi Lu <emilu@encs.concordia.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!