pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #6452: psql: can't change client encoding from the command line
3+ messages / 3 participants
[nested] [flat]

* BUG #6452: psql: can't change client encoding from the command line
@ 2012-02-11 18:02 felix.gerzaguet@gmail.com
  2012-02-14 12:41 ` Re: BUG #6452: psql: can't change client encoding from the command line Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
  0 siblings, 1 reply; 3+ messages in thread

From: felix.gerzaguet@gmail.com @ 2012-02-11 18:02 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      6452
Logged by:          Félix
Email address:      felix.gerzaguet@gmail.com
PostgreSQL version: 9.1.2
Operating system:   Win XP Pro SP3
Description:        

Hi,

here is the problem:

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





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #6452: psql: can't change client encoding from the command line
  2012-02-11 18:02 BUG #6452: psql: can't change client encoding from the command line felix.gerzaguet@gmail.com
@ 2012-02-14 12:41 ` Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
  2012-02-15 17:37   ` Re: BUG #6452: psql: can't change client encoding from the command line Félix GERZAGUET <felix.gerzaguet@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Heikki Linnakangas @ 2012-02-14 12:41 UTC (permalink / raw)
  To: felix.gerzaguet@gmail.com; +Cc: pgsql-bugs

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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #6452: psql: can't change client encoding from the command line
  2012-02-11 18:02 BUG #6452: psql: can't change client encoding from the command line felix.gerzaguet@gmail.com
  2012-02-14 12:41 ` Re: BUG #6452: psql: can't change client encoding from the command line Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
@ 2012-02-15 17:37   ` Félix GERZAGUET <felix.gerzaguet@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Félix GERZAGUET @ 2012-02-15 17:37 UTC (permalink / raw)
  To: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>; +Cc: pgsql-bugs

Thanks for the workaround. I'll use it untill the bug is fixed :-)

--
Félix



On Tue, Feb 14, 2012 at 1:41 PM, Heikki Linnakangas <
heikki.linnakangas@enterprisedb.com> wrote:

> 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
>

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2012-02-15 17:37 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-02-11 18:02 BUG #6452: psql: can't change client encoding from the command line felix.gerzaguet@gmail.com
2012-02-14 12:41 ` Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
2012-02-15 17:37   ` Félix GERZAGUET <felix.gerzaguet@gmail.com>

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