Search Postgresql Archives

Unicode and unaccent()

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

 



I am trying to write an unaccent function because I need to do some queries comparing data that has accents and data that does not.

 

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 have tried and failed to get this working using the what I think is the Unicode escaping method \u0032 for example.

 

Even if someone could help me with the Unicode escaping method that would be useful.  For example if I wanted to find a Unicode character 0x00E2 with a select statement how would I?

 

Something like select * from table where field like ‘%\u00e2%’;

 

Doesn’t seem to work.

 

Does anyone have a good method for unaccenting Unicode dbs/characters?

 

I am using PG7.4 on FC2

 

Thank you


[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