Reputation: 2958
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:
ERROR: syntax error at or near "USING"
So the correct SQL should have been:
SELECT convert('text_in_utf8', 'UTF8', 'LATIN1');
Upvotes: 0
Views: 778
Reputation: 247270
convert_from
and convert_to
still exist, but they cannot convert from text
to text
because text
is always a string in the database encoding. Strings in other encoding can only be stored as bytea
.
I cannot guide you any further, because you didn't tell us what problem you are trying to solve.
Upvotes: 1