Re: how to ignore accents?

From: Ennio-Sr <nasr(dot)laili(at)tin(dot)it>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: how to ignore accents?
Date: 2005-03-31 00:01:45
Message-ID: 20050331000145.GA8344@deby.ei.hnet
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

* Celia McInnis <celia(at)drmath(dot)ca> [300305, 12:29]:
> I have French text with accents in it and would rather (for search purposes)
> be able to search for things with the accents removed. Is there any builtin
> postgres function which will do this?
>
> Here is the format of some accented (French) words in my database:
>
> fran\347ais caf\351 t\364\t br\373le r\352ver \342nes b\350gues
>
> which I want to be able to search for as:
>
> francais cafe tot brule rever anes begues
>
> Celia
>

Hi Celia,

I'm not an expert, but I'm afraid it's not possible to do that (and I'd
be glad if somebody came out saying I'm wrong as I've the same problem).
However, you can achieve a similar result using _like_ and truncating
the accented words so that only un-accented letters are searched for.

In your example, you would use:

mydb=> select * from your_table where col_title like '%franc%';
mydb=> select * from your_table where col_title like '%caf%';
mydb=> select * from your_table where col_title like '%gues%';
and so on.

Hope that helps.
Regards,
Ennio.

--
[Perche' usare Win$ozz (dico io) se ..."anche uno sciocco sa farlo. \\?//
Fa' qualche cosa di cui non sei capace!" (diceva Henry Miller) ] (°|°)
[Why use Win$ozz (I say) if ... "even a fool can do that. )=(
Do something you aren't good at!" (as Henry Miller used to say) ]

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Fuhr 2005-03-31 00:42:36 Re: how to ignore accents?
Previous Message Tom Lane 2005-03-30 19:07:20 Re: rpm install issues - RHE3