Hello!
Is there any way in PostgreSQL to convert UTF-8 characters to "similar" ASCII characters?
String glāžšķūņu rūķīši
would have to be converted to glazskunu rukisi
. UTF-8 text is not in some specific language, it might be in Latvian, Russian, English, Italian or any other language.
This is needed for using in where
clause, so it might be just "comparing strings" rather than "converting strings".
I tried using convert
, but it does not give desired results (e.g., select convert('Ā', 'utf8', 'sql_ascii')
gives \304\200
, not A
).
Database is created with:
ENCODING = 'UTF8'
LC_COLLATE = 'Latvian_Latvia.1257'
LC_CTYPE = 'Latvian_Latvia.1257'
These params may be changed, if necessary.