Search Postgresql Archives

Re: Unicode and unaccent()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



	Mark Borins wrote:

> The encoding on my DB is Unicode, so far I have found an unaccent() function
> by looking in the mail archives it looks like the following:
> 
> 
> CREATE FUNCTION unaccent(text) RETURNS text AS $$
>    BEGIN
>        RETURN translate($1, '\342\347\350\351\352\364\373', 'aceeeou')
>  ;  END;  $$ LANGUAGE plpgsql IMMUTABLE STRICT;
> 
> My problem is that the values like \342 are for LATIN1 type encoding.  I

Why wouldn't this:
   RETURN translate($1, 'éçàêè...', 'ecaee...') ;
work just fine? It's even portable across encodings.

-- 
 Daniel
 PostgreSQL-powered mail user agent and storage: http://www.manitou-mail.org


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
      message can get through to the mailing list cleanly


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux