AlfaTeK
AlfaTeK

Reputation: 7765

How can I do a accent insensitive search in Postgres 8.3.x with a DB in utf-8?

Tried select to_ascii('capo','LATIN1'), to_ascii('çapo','LATIN1') and the results are different....

Upvotes: 5

Views: 3481

Answers (1)

Milen A. Radev
Milen A. Radev

Reputation: 62573

Look here.

CREATE FUNCTION to_ascii(bytea, name)
RETURNS text STRICT AS 'to_ascii_encname' LANGUAGE internal;

and then just use it like this:

SELECT to_ascii(convert_to('Übermeier', 'latin1'), 'latin1'); 

Upvotes: 3

Related Questions