EDIT:
I think I was not clear, I am sorry for that: I have a column with bytea data. This column, when I apply encode(column,'escape') to it, I got text in the iso8859-1 encoding. I would like to change this text to UTF-8 encoding.
However, when I use the convert function:
SELECT convert(encode(column,'escape'),'LATIN1','UTF8') FROM table
I got the error: function convert(text, unknown, unknown) does not exist.
I am currently stuck at this point.
Previous question: When I call convert(encode(column,'escape' When I do:
select encode(name_of_column, 'escape')
from my_table;
I get a varchar encoded in iso88591 instead of UTF-8. I use Postgresql 12. I cannot find a convert function like Oracle convert function for this Postgresql version.
Does anyone know how to deal with this issue?
As iso8859-1 is also called Latin 1, you can use convert
SELECT convert( 'text_in_Latin 1 or so8859-1 ', 'LATIN1','UTF8')
| convert | |:--------------------------------------------------------- | | \x746578745f696e5f4c6174696e2031206f7220736f383835392d3120 |
db<>fiddle here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.