Re: Unicode and unaccent()

Поиск
Список
Период
Сортировка
От Daniel Verite
Тема Re: Unicode and unaccent()
Дата
Msg-id 20050506111123.1377220@localhost
обсуждение исходный текст
Ответ на Unicode and unaccent()  ("Mark Borins" <mark.borins@rigadev.com>)
Список pgsql-general
    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


В списке pgsql-general по дате отправления:

Предыдущее
От: Peter Wilson
Дата:
Сообщение: Re: Slony v. DBMirror
Следующее
От: CSN
Дата:
Сообщение: plphp1.1 make fails