mirror of
https://github.com/postgres/postgres.git
synced 2025-04-22 23:02:54 +03:00
Strip certain classes of combining characters, so that accents encoded this way are removed. Author: Hugh Ranalli Discussion: https://postgr.es/m/15548-cef1b3f8de190d4f%40postgresql.org
25 lines
701 B
SQL
25 lines
701 B
SQL
CREATE EXTENSION unaccent;
|
|
|
|
-- must have a UTF8 database
|
|
SELECT getdatabaseencoding();
|
|
|
|
SET client_encoding TO 'UTF8';
|
|
|
|
SELECT unaccent('foobar');
|
|
SELECT unaccent('ёлка');
|
|
SELECT unaccent('ЁЖИК');
|
|
SELECT unaccent('˃˖˗˜');
|
|
SELECT unaccent('À'); -- Remove combining diacritical 0x0300
|
|
|
|
SELECT unaccent('unaccent', 'foobar');
|
|
SELECT unaccent('unaccent', 'ёлка');
|
|
SELECT unaccent('unaccent', 'ЁЖИК');
|
|
SELECT unaccent('unaccent', '˃˖˗˜');
|
|
SELECT unaccent('unaccent', 'À');
|
|
|
|
SELECT ts_lexize('unaccent', 'foobar');
|
|
SELECT ts_lexize('unaccent', 'ёлка');
|
|
SELECT ts_lexize('unaccent', 'ЁЖИК');
|
|
SELECT ts_lexize('unaccent', '˃˖˗˜');
|
|
SELECT ts_lexize('unaccent', 'À');
|