Using PostgreSQL when I connect to a db using \c testdb inside PostgreSQL Database SQL Prompt. I successfully connect to the db but getting the following warning:
postgres-# \c testdb
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.
You are now connected to database "testdb" as user "postgres".
testdb-#
What does this warning mean? How to resolve it?
From the psql documentation:
psql is built as a "console application". Since the Windows console windows use a different encoding than the rest of the system, you must take special care when using 8-bit characters within psql. If psql detects a problematic console code page, it will warn you at startup.
To change the console code page, two things are necessary: 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.
So to remove that warning you need to execute chcp 1252 before you enterpsql. Using chcp without parameters gives you the current codepage.
The default codepage for CMD.exe is different than the default for postgres... To change for CMD.exe using the REGISTRY try this:
Then reopen CMD.exe
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With