Thanks a lot Craig Ringer, works, finally works! You are my new idool now!
The steps are:
- open the cmd
SET PGCLIENTENCODING=utf-8
chcp 65001
psql -h your.ip.addr.ess -U postgres
Pregunta
I'm working in a centralized monitoring system on Windows 2008 R2, I have installed a PostgreSQL 9.3 to use psql from the command line.
When I try to access to some remote Postgres (an 8.4 in my principal case) I have an error with the encoding:
command:
psql.exe -h 192.168.114.12 -p 5432 -d db_seros_transaccion -U postgres -f script.sql
error:
psql: FATAL: la conversión entre WIN1252 y LATIN1 no está soportada
I try adding the sentence
SET client_encoding = 'UTF8';
in my script but the problem persist (and with other encodings too, like LATIN1 & WIN1252).
After googling it I found people that update some rows in the server to make the connection, and this is a problem to me.
Can anyone help me to make a connection using psql without an update? Is it possible?
Solución
Thanks a lot Craig Ringer, works, finally works! You are my new idool now!
The steps are:
SET PGCLIENTENCODING=utf-8
chcp 65001
psql -h your.ip.addr.ess -U postgres
Otros consejos
Windows 10 / Windows server 2016 or later:
Windows Control Panel
Region (and Language)
Change system locale
Beta: Use Unicode UTF-8 for worldwide language support
or
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage]
"ACP"="65001"
"OEMCP"="65001"
"MACCP"="65001"
The PowerShell console and CMD will display Cyrillic correctly
As an option, try enter this command in psql :
postgres=# \! chcp 65001
65001 is equals UTF-8
1251 = WIN 1251