How can I have a working PSQL console using UTF8 encoding under Windows?
I have a Windows server and client. The Postgres 12 database contains tables with content in multiple languages (ex: English, French (with characters such as
é), Korean (with characters such as
The DB is encoded as UTF8.
client_encoding is set to
The console code page is set to 65001 (Microsoft's UTF8 codepage), and has a suitable font ( Lucida Console)
I must be able to properly display English and French text, query the DB in English and French and be able to "output something", i.e. not get any error, if touching text in another language.
The issue is I can't type / copy-paste any accented character. If I do, the special character acts as a comment but the input continues on the next line, and I need to close it again.
In the following example, note that
é_fg is gone, that there is no prompt on the
hij line and that the output concatenates
abcd_hij on one line
myuser=> select 'abcd_é_fg'; hij myuser'> klm'; ?column? ---------- abcd_hij+ klm (1 row)
The issue is really with the typing, because I can export and load files containing such chars.
select 'é'; in
psql -U myuser -d mydb -f C:/sel.sql
?column? ---------- é
On the working well side, I can display what I need
select chr(8217); --sort of apostrophe chr ----- ’ select chr(48652); chr ----- 브 --(though displayed as a square - unknown character, ok)
I have tried to set Windows language for non-Unicode program to UTF8, which had no effect on the issue.
If I set the code page to 1252 and the client-encoding to Win1252, I can display the accented chars, I can type them, but if I want to display text in another language like Korean I get and error
ERROR: character with byte sequence 0xeb 0xb8 0x8c in encoding "UTF8" has no equivalent in encoding "WIN1252"