pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
To: felix.gerzaguet@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6452: psql: can't change client encoding from the command line
Date: Tue, 14 Feb 2012 14:41:14 +0200
Message-ID: <4F3A566A.9060606@enterprisedb.com> (raw)
In-Reply-To: <E1RwHHj-0002h6-Ds@wrigleys.postgresql.org>
References: <E1RwHHj-0002h6-Ds@wrigleys.postgresql.org>

On 11.02.2012 20:02, felix.gerzaguet@gmail.com wrote:
> Using the command line, I can't change the client encoding, but I can change
> it using the "\encoding" command :
>
> C:\>psql --variable=ENCODING=UTF8
> could not find a "psql" to execute
> could not find a "psql" to execute
> psql (9.1.2)
> WARNING: Console code page (850) differs from Windows code page (1252)
>           8-bit characters might not work correctly. See psql reference
>           page "Notes for Windows users" for details.
> Type "help" for help.
>
> postgres=# \encoding
> WIN1252
> postgres=# \echo :ENCODING
> WIN1252
> postgres=# \encoding UTF8
> postgres=# \encoding
> UTF8
> postgres=# \echo :ENCODING
> UTF8
> postgres=# \q

Yeah, "\set ENCODING UTF8" doesn't seem to work either. The "ENCODING" 
psql variable tracks changes to the server's client_encoding setting, 
but not vice versa. That probably should be fixed, or at least it should 
throw an error telling the user to use \encoding instead.

As a workaround, you can set the PGCLIENTENCODING environment variable 
before launching psql.

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com



view thread (3+ messages)  latest in thread

Message-ID: <4F3A566A.9060606@enterprisedb.com>
Permalink:  ../4F3A566A.9060606@enterprisedb.com/
Also on:    postgresql.org/message-id/4F3A566A.9060606@enterprisedb.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-bugs@postgresql.org
  Cc: heikki.linnakangas@enterprisedb.com, felix.gerzaguet@gmail.com
  Subject: Re: BUG #6452: psql: can't change client encoding from the command line
  In-Reply-To: <4F3A566A.9060606@enterprisedb.com>
  References: <E1RwHHj-0002h6-Ds@wrigleys.postgresql.org> <4F3A566A.9060606@enterprisedb.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