Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Y1UhH-0000Mw-W3 for pgsql-novice@arkaria.postgresql.org; Thu, 18 Dec 2014 06:36:28 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Y1UhH-0001gZ-Cn for pgsql-novice@arkaria.postgresql.org; Thu, 18 Dec 2014 06:36:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Y1UhG-0001gT-Fi for pgsql-novice@postgresql.org; Thu, 18 Dec 2014 06:36:26 +0000 Received: from mail-pa0-x22d.google.com ([2607:f8b0:400e:c03::22d]) by magus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1Y1UhC-0002gZ-6p for pgsql-novice@postgresql.org; Thu, 18 Dec 2014 06:36:25 +0000 Received: by mail-pa0-f45.google.com with SMTP id lf10so762765pab.32 for ; Wed, 17 Dec 2014 22:36:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; bh=3vvk5qMn3urN9DhcAgBQbphXHE6tGjdwsLpoyjrvgNk=; b=VW/8IeTRiRLrE+o2ifrXadpKGn4SLBFkaBXZWF20LS6ZHKp2YPgpVzJIuzE6EkdHVI tv/0g0yFs/QqLcS/IUhwFu0pC5TC7446EfXDr6zLBF8eGe5oSbvtCJtKrghagBkg3W47 vJpz+gBcuKeawgr8Z5si1BiRaybFD11wmQDiY86DKuPSNIHqs5UrgQgmPrZsU/sSx7vX 2Rv5QBuzeo7q5aE6SqAOz1F0jU2B9bUtd4HkV/XPwZOK+yUtb6WoVf4sezvEYta5SZLK fmnW0/XlB0654Ib4K9Wrts8Q/u9zSwmdaaO1ZYA4tNGg8wq7jiXpsLuRzkhMRtLRnXy4 FlVQ== X-Received: by 10.70.7.131 with SMTP id j3mr846865pda.20.1418884578732; Wed, 17 Dec 2014 22:36:18 -0800 (PST) Received: from [127.0.0.1] ([203.111.224.32]) by mx.google.com with ESMTPSA id vb4sm5749186pab.19.2014.12.17.22.36.13 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Dec 2014 22:36:17 -0800 (PST) Message-ID: <549275CC.4010607@gmail.com> Date: Thu, 18 Dec 2014 14:35:56 +0800 From: Scott Robertson User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:15.0) Gecko/20120907 Thunderbird/15.0.1 MIME-Version: 1.0 To: pgsql-novice@postgresql.org Subject: Re: warning about console code page on starting psql References: <54910242.3090706@gmail.com> <549113EA.2010007@gmail.com> <1418795707357-5831042.post@n5.nabble.com> In-Reply-To: Content-Type: multipart/alternative; boundary="------------060207030108030208060606" X-Antivirus: avast! (VPS 141217-1, 12/18/2014), Outbound message X-Antivirus-Status: Clean X-Pg-Spam-Score: 0.6 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-novice Precedence: bulk Sender: pgsql-novice-owner@postgresql.org This is a multi-part message in MIME format. --------------060207030108030208060606 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit SOLVED, see below On 12/17/2014 2:06 PM, David Johnston wrote: > On Tuesday, December 16, 2014, David Johnston > > wrote: > > Forwarding to -docs for now. > > I suggest simply dropping the "cmd.exe /c"part from the docs and > mention that the command should be run from an active console. A > recommendation for a batch file or similar would be nice. I > may put together an actual patch if I get a chance and don't see > one come across but for now just reporting this. Would want to > research methods for making both these items persist and > recommending such. See my other curiosities below... > > David J. > > ---------- Forwarded message ---------- > From: *David G Johnston [via PostgreSQL]* > > > Date: Tuesday, December 16, 2014 > Subject: Re: warning about console code page on starting psql > To: David G Johnston > > > > Stephen Cook-2 wrote > On 12/16/2014 11:10 PM, Scott Robertson wrote: > > Set the code page by entering cmd.exe /c chcp 1252. (1252 is > a code > > page that is appropriate for German; replace it with your > value.) If > > you are using Cygwin, you can put this command in /etc/profile. > > Do not type the "cmd.exe /c" part. This will run a new > instance of "cmd" > (the Windows command-line console); "\c" means "run the following > command"... So you are basically starting a new console, > changing the > code page within that new console, and exiting back to your > original > console. > > Instead, once you have a command prompt, use "chcp 1252" to > change the > code page of the Windows console to match the code page "psql" > expects > from Windows. Then you can run "psql" without the warning. You > will have > to do this each time you open a new command line console, > before running > "psql", as far as I can tell. > > -- Stephen > > So basically the documented fix is useless. At least a "/k" would > keep the new console with altered code page around for interactive > use but the /c switch simply kills the console after running a > single command whose sole purpose is to change the to-be-killed > console's codepage. > > It is implied that since you are chasing the console codepage that > the target value would be whatever Window's is using...but that > could be made more clear as well. > > Encodings are confusing and this doesn't even mention using > windows psql against Linux or how Unicode would fit in - though > external notes indicate that the font change suggestion also > solves Unicode characters as well as dealing with ANSI... > > http://ss64.com/nt/chcp.html > > David J. > > The only saving grace I can see is that it does make cmd.exe explicit > since Windows does have PowerShell, though how it behaves I do not > know either.... > > David J. Case closed and much learned. The documentation was depending on me remembering some things learned from a dos class almost 20 years ago, haven't used the command line console since. SUMMARY OF SOLUTION start console cmd.exe use icon upper left on title bar to change font to Lucida Console change to root directory: cd\ check the code page to confirm it's wrong: chcp change the code page: chcp 1252 change to postgresql directory; in my Windows 7 it's: cd program files\postgresql\9.4\bin\ open psql (in same console) as superuser so operating system user password isn't expected: psql -U postgres prompt comes up for postgres password RESULTS: Microsoft Windows [Version 6.1.7600] C:\Users\Luther>cd/ C:\>chcp Active code page: 437 C:\>chcp 1252 Active code page: 1252 C:\>cd program files\postgresql\9.4\bin\ C:\Program Files\PostgreSQL\9.4\bin> C:\Program Files\PostgreSQL\9.4\bin>psql -U postgres Password for user postgres: psql (9.4rc1) Type "help" for help. postgres=# \c testdb2 You are now connected to database "testdb2" as user "postgres". testdb2=# select * from jedstblinmelsdb; key | name | address -----+------+--------- (0 rows) --- This email has been checked for viruses by Avast antivirus software. http://www.avast.com --------------060207030108030208060606 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit SOLVED, see below

On 12/17/2014 2:06 PM, David Johnston wrote:
On Tuesday, December 16, 2014, David Johnston <david.g.johnston@gmail.com> wrote:
Forwarding to -docs for now.  

I suggest simply dropping the "cmd.exe /c"part from the docs and mention that the command should be run from an active console.  A recommendation for a batch file or similar would be nice.  I may put together an actual patch if I get a chance and don't see one come across but for now just reporting this.  Would want to research methods for making both these items persist and recommending such.  See my other curiosities below...

David J.

---------- Forwarded message ----------
From: David G Johnston [via PostgreSQL] <ml-node+s1045698n5831042h26@n5.nabble.com>
Date: Tuesday, December 16, 2014
Subject: Re: warning about console code page on starting psql
To: David G Johnston <david.g.johnston@gmail.com>


Stephen Cook-2 wrote
On 12/16/2014 11:10 PM, Scott Robertson wrote:
> Set the code page by entering cmd.exe /c chcp 1252. (1252 is a code
> page that is appropriate for German; replace it with your value.) If
> you are using Cygwin, you can put this command in /etc/profile.

Do not type the "cmd.exe /c" part. This will run a new instance of "cmd"
(the Windows command-line console); "\c" means "run the following
command"... So you are basically starting a new console, changing the
code page within that new console, and exiting back to your original
console.

Instead, once you have a command prompt, use "chcp 1252" to change the
code page of the Windows console to match the code page "psql" expects
from Windows. Then you can run "psql" without the warning. You will have
to do this each time you open a new command line console, before running
"psql", as far as I can tell.

-- Stephen
So basically the documented fix is useless.  At least a "/k" would keep the new console with altered code page around for interactive use but the /c switch simply kills the console after running a single command whose sole purpose is to change the to-be-killed console's codepage.

It is implied that since you are chasing the console codepage that the target value would be whatever Window's is using...but that could be made more clear as well.

Encodings are confusing and this doesn't even mention using windows psql against Linux or how Unicode would fit in - though external notes indicate that the font change suggestion also solves Unicode characters as well as dealing with ANSI...

http://ss64.com/nt/chcp.html

David J.

The only saving grace I can see is that it does make cmd.exe explicit since Windows does have PowerShell, though how it behaves I do not know either....

David J. 

Case closed and much learned. The documentation was depending on me remembering some things learned from a dos class almost 20 years ago, haven't used the command line console since.

SUMMARY OF SOLUTION
start console cmd.exe
use icon upper left on title bar to change font to Lucida Console
change to root directory: cd\
check the code page to confirm it's wrong: chcp
change the code page: chcp 1252
change to postgresql directory; in my Windows 7 it's: cd program files\postgresql\9.4\bin\
open psql (in same console) as superuser so operating system user password isn't expected: psql -U postgres
prompt comes up for postgres password

RESULTS:
Microsoft Windows [Version 6.1.7600]

C:\Users\Luther>cd/

C:\>chcp
Active code page: 437

C:\>chcp 1252
Active code page: 1252

C:\>cd program files\postgresql\9.4\bin\

C:\Program Files\PostgreSQL\9.4\bin>
C:\Program Files\PostgreSQL\9.4\bin>psql -U postgres
Password for user postgres:
psql (9.4rc1)
Type "help" for help.

postgres=# \c testdb2
You are now connected to database "testdb2" as user "postgres".
testdb2=# select * from jedstblinmelsdb;
 key | name | address
-----+------+---------
(0 rows)



This email has been checked for viruses by Avast antivirus software.
www.avast.com


--------------060207030108030208060606--