X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 8E929D1B523 for ; Thu, 25 Sep 2003 23:51:23 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 82257-03 for ; Thu, 25 Sep 2003 20:50:54 -0300 (ADT) Received: from dbdevel.sunwave.net (Helium.sunwave.net [64.141.16.15]) by svr1.postgresql.org (Postfix) with ESMTP id 51370D1B504 for ; Thu, 25 Sep 2003 20:50:51 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by dbdevel.sunwave.net (Postfix) with ESMTP id 20990178003 for ; Thu, 25 Sep 2003 19:50:54 -0400 (EDT) From: Michael A Nachbaur To: pgsql-sql@postgresql.org Subject: RFC: i18n2ascii(TEXT) stored procedure Date: Thu, 25 Sep 2003 16:50:53 -0700 User-Agent: KMail/1.5 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200309251650.53855.mike@nachbaur.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/317 X-Sequence-Number: 15295 I've created the following stored procedure to allow me to do=20 international-insensitive text searches, e.g. a search for "Resume" would= =20 match the text "R=E9sum=E9". I wanted to know: a) am I missing any characters that need to be converted? My first (and on= ly=20 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= =20 searches to bog down (at least too badly) as a result of this. CREATE OR REPLACE FUNCTION i18n2ascii (TEXT) RETURNS TEXT AS ' my ($source) =3D @_; $source =3D~=20 tr/=E1=E0=E2=E4=E9=E8=EA=EB=ED=EC=EE=EF=F3=F2=F4=F6=FA=F9=FB=FC=C1=C0=C2=C4= =C9=C8=CA=CB=CD=CC=CE=CF=D3=D2=D4=D6=DA=D9=DB=DC/aaaaeeeeiiiioooouuuuAAAAEE= EEIIIIOOOOUUUU/; return $source; ' LANGUAGE 'plperl'; --=20 /* Michael A. Nachbaur * http://nachbaur.com/pgpkey.asc */ "Ah, " said Arthur, "this is obviously some strange usage=20 of the word safe that I wasn't previously aware of. "