How can I transcode a UTF-8 string to Latin1 with PostgreSQL 13+ ?
I've read this SO thread but the functions convert()
, convert_from()
and convert_to()
no longer exist starting from Postgres 13.
EDIT: the solution is given by Laurenz Albe, who pointed out that the functions still exist. I was only afterwards that I noticed:
- Google made me land on the manual for 8.2, for which convert() has a different signature than in version 8.3+
- I tried the 8.2 SQL code that resulted in
ERROR: syntax error at or near "USING"
- I couldn't find the function in the version 13 docs, because:
- the function manual has been moved to Binary functions
So the correct SQL should have been:
SELECT convert('text_in_utf8', 'UTF8', 'LATIN1');