Skip to content

Instantly share code, notes, and snippets.

@samirfor
Created January 4, 2016 17:01
Show Gist options
  • Save samirfor/3658f379c21b5ae929ae to your computer and use it in GitHub Desktop.
Save samirfor/3658f379c21b5ae929ae to your computer and use it in GitHub Desktop.
remove diacritics (i.e. a sign, such as an accent or cedilla, which when written above or below a letter indicates a difference in pronunciation from the same letter when unmarked or differently marked)
CREATE FUNCTION lower_unaccent(text) RETURNS text
LANGUAGE sql IMMUTABLE STRICT
AS $_$
SELECT lower(translate($1
, '¹²³áàâãäåāăąÀÁÂÃÄÅĀĂĄÆćčç©ĆČÇĐÐèéêёëēĕėęěÈÊËЁĒĔĖĘĚ€ğĞıìíîïìĩīĭÌÍÎÏЇÌĨĪĬłŁńňñŃŇÑòóôõöōŏőøÒÓÔÕÖŌŎŐØŒř®ŘšşșߊŞȘùúûüũūŭůÙÚÛÜŨŪŬŮýÿÝŸžżźŽŻŹ'
, '123aaaaaaaaaaaaaaaaaaacccccccddeeeeeeeeeeeeeeeeeeeeggiiiiiiiiiiiiiiiiiillnnnnnnooooooooooooooooooorrrsssssssuuuuuuuuuuuuuuuuyyyyzzzzzz'
));
$_$;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment