From: | Jean Gabriel <postgres(at)GISspecialists(dot)com> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | PSQL console encoding |
Date: | 2020-06-16 14:25:55 |
Message-ID: | 601fb533-ec08-b485-d0e4-b401c3dd4830@GISspecialists.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello,
I am having some issues setting/using my PSQL console encoding to UTF-8
under Windows 10.
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 |브|)).
select version();
version
------------------------------------------------------------
PostgreSQL 12.1, compiled by Visual C++ build 1914, 64-bit
The DB is encoded as |UTF8|
|
|
|show server_encoding;
server_encoding
-----------------
UTF8|
|
|
The |client_encoding| is set to |UTF8|
|
|
| show client_encoding;
client_encoding
-----------------
UTF8|
|
|
The console code page is set to |65001| (Microsoft's UTF8 codepage), and
has a suitable font ( |Lucida Console|).
I nevertheless get the different code page warning when logging to my DB
psql (12.1)
WARNING: Console code page (65001) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference
page "Notes for Windows users" for details.
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 (1row)|
The issue is really with the typing, because I can export and load files
containing such chars.
Ex: save |select 'é';| in |sel.sql|, run |psql -U myuser -d mydb -f
C:/sel.sql| will output
|?column?----------é|
------------------------------------------------------------------------
On the working well side, I can display what I need
|selectchr(8217);--sort of apostrophechr -----’selectchr(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. The setting was recognized as
the PSQL warning (Console code page (65001) differs from Windows code
page (1252)) was not displayed anymore, but I still couldn't do select 'é';
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
|selectchr(48652);ERROR:character withbyte sequence
0xeb0xb80x8cinencoding "UTF8"has no equivalent inencoding "WIN1252" |
||So back to the question, is there a way of having a working UTF8 psql
console?
Thank you,
Jean Gabriel
From | Date | Subject | |
---|---|---|---|
Next Message | Pepe TD Vo | 2020-06-16 14:59:24 | Re: create batch script to import into postgres tables |
Previous Message | Adrian Klaver | 2020-06-16 14:24:57 | Re: create batch script to import into postgres tables |