Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 316C5111581 for ; Tue, 14 Feb 2012 08:41:36 -0400 (AST) Received: from exprod7og109.obsmtp.com ([64.18.2.171]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RxHhM-00054s-QU for pgsql-bugs@postgresql.org; Tue, 14 Feb 2012 12:41:35 +0000 Received: from mail-lpp01m010-f52.google.com ([209.85.215.52]) (using TLSv1) by exprod7ob109.postini.com ([64.18.6.12]) with SMTP ID DSNKTzpWbeD3wdYkfHtjyOaXTouiEyS2sM3t@postini.com; Tue, 14 Feb 2012 04:41:32 PST Received: by mail-lpp01m010-f52.google.com with SMTP id y4so4526644lag.25 for ; Tue, 14 Feb 2012 04:41:17 -0800 (PST) Received: by 10.112.38.37 with SMTP id d5mr5495623lbk.5.1329223277571; Tue, 14 Feb 2012 04:41:17 -0800 (PST) Received: from [192.168.1.104] (dsl-hkibrasgw2-ff6cc300-200.dhcp.inet.fi. [88.195.108.200]) by mx.google.com with ESMTPS id j4sm16354452lbf.6.2012.02.14.04.41.15 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 14 Feb 2012 04:41:15 -0800 (PST) Message-ID: <4F3A566A.9060606@enterprisedb.com> Date: Tue, 14 Feb 2012 14:41:14 +0200 From: Heikki Linnakangas User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20120104 Icedove/8.0 MIME-Version: 1.0 To: felix.gerzaguet@gmail.com CC: pgsql-bugs@postgresql.org Subject: Re: BUG #6452: psql: can't change client encoding from the command line References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQmMxbx9j2cPWPt3QPfliHfjMs/BaysixsdsSGK6FbN8q3d7H/VDFfy8QNSIt8MWV5bmH9tb X-Pg-Spam-Score: -4.2 (----) X-Archive-Number: 201202/107 X-Sequence-Number: 32450 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