pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jean Gabriel <postgres@GISspecialists.com>
To: pgsql-general@lists.postgresql.org
Subject: PSQL console encoding
Date: Tue, 16 Jun 2020 10:25:55 -0400
Message-ID: <601fb533-ec08-b485-d0e4-b401c3dd4830@GISspecialists.com> (raw)

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

Message-ID: <601fb533-ec08-b485-d0e4-b401c3dd4830@GISspecialists.com>
Permalink:  ../601fb533-ec08-b485-d0e4-b401c3dd4830@GISspecialists.com/
Also on:    postgresql.org/message-id/601fb533-ec08-b485-d0e4-b401c3dd4830@GISspecialists.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: postgres@GISspecialists.com
  Subject: Re: PSQL console encoding
  In-Reply-To: <601fb533-ec08-b485-d0e4-b401c3dd4830@GISspecialists.com>
  References: <601fb533-ec08-b485-d0e4-b401c3dd4830@GISspecialists.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox