sqlpostgresqlunaccent

Unaccent extension of Postgresql 9.1 returning empty row


I created the extension "unaccent" on the postgresql database but when I run a select using the "unaccent" it always return 1 row but with a blank line.

select ts_lexize('unaccent', 'Hôtel');
ts_lexize
-----------

(1 row)

Expected according to the documentation:

select ts_lexize('unaccent','Hôtel');
ts_lexize
-----------
{Hotel}
(1 row)

Also when I run:

SELECT unaccent('unaccent', 'Hôtel');

it shows:

unaccent
----------
Hôtel
(1 row)

Solution

  • I just discovered that the problem was that the database encoding, which was using the SQL_ASCII encoding, so I dropped the database, recreated it with UTF-8 and then it started to worked fine. It seems that the unaccent doesn't work with SQL_ASCII.