RFC: i18n2ascii(TEXT) stored procedure - Mailing list pgsql-sql

From Michael A Nachbaur
Subject RFC: i18n2ascii(TEXT) stored procedure
Date
Msg-id 200309251650.53855.mike@nachbaur.com
Whole thread Raw
Responses Re: RFC: i18n2ascii(TEXT) stored procedure  (Manuel Sugawara <masm@fciencias.unam.mx>)
Re: RFC: i18n2ascii(TEXT) stored procedure  (Peter Eisentraut <peter_e@gmx.net>)
Re: RFC: i18n2ascii(TEXT) stored procedure  ("scott.marlowe" <scott.marlowe@ihs.com>)
List pgsql-sql
I've created the following stored procedure to allow me to do
international-insensitive text searches, e.g. a search for "Resume" would
match the text "Résumé".

I wanted to know:

a) am I missing any characters that need to be converted?  My first (and only
language) is English, so I'm in the dark when that is concerned;
b) is there a better and/or faster way of implementing this?  I don't want
searches to bog down (at least too badly) as a result of this.

CREATE OR REPLACE FUNCTION i18n2ascii (TEXT) RETURNS TEXT AS '   my ($source) = @_;   $source =~
tr/áàâäéèêëíìîïóòôöúùûüÁÀÂÄÉÈÊËÍÌÎÏÓÒÔÖÚÙÛÜ/aaaaeeeeiiiioooouuuuAAAAEEEEIIIIOOOOUUUU/;   return $source;
' LANGUAGE 'plperl';

--
/* Michael A. Nachbaur <mike@nachbaur.com>* http://nachbaur.com/pgpkey.asc*/

"Ah, " said Arthur, "this is obviously some strange usage
of the word safe that I wasn't previously aware of. "



pgsql-sql by date:

Previous
From: Wei Weng
Date:
Subject: tsearch2 question
Next
From: Manuel Sugawara
Date:
Subject: Re: RFC: i18n2ascii(TEXT) stored procedure