Whenever I access psql, I get the following message:
psql (9.6.2)
WARNING: Console code page (437) 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=#
I tried command
cmd.exe /c chcp 1252
before running runpsql.bat file in command line. And there, it runs fine without the error. But accessing psql again after closing command prompt, throws the same warning. How do I solve this warning within SQL Shell?
I am using windows 10 OS.
Edit:
This is what I did:
Microsoft Windows [Version 10.0.10586]
(c) 2015 Microsoft Corporation. All rights reserved.
C:\Users\Sarthak Joshi>E:
E:\>cd PostgreSQL
E:\PostgreSQL>cd scripts
E:\PostgreSQL\scripts>chcp 1252
Active code page: 1252
E:\PostgreSQL\scripts>runpsql.bat
Server [localhost]:
Database [postgres]:
Port [5432]:
Username [postgres]:
Password for user postgres:
psql (9.6.2)
Type "help" for help.
postgres=#
But after exiting from cmd, and firing up shell like this:
Server [localhost]:
Database [postgres]:
Port [5432]:
Username [postgres]:
Password for user postgres:
psql (9.6.2)
WARNING: Console code page (437) 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=#
It still throws the same warning…
Best Answer
When you use
cmd.exe /c chcp 1252
in the batch file, you start a new command line, change the codepage for that and then that command line is immediately terminated, but the one that runspsql
has not bee changed.Just put:
(without calling
cmd.exe
) into the batch file.