PostgreSQL:使用psql命令行实用程序时在Windows上的编码问题 [英] PostgreSQL: encoding problems on Windows when using psql command line utility
问题描述
我在Windows 2008 R2上的集中监控系统中工作,我已经安装了PostgreSQL 9.3,从命令行使用 psql 。
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.
当我尝试访问一些远程Postgres(在我的主要情况下,8.4)我有一个编码错误:
When I try to access to some remote Postgres (an 8.4 in my principal case) I have an error with the encoding:
命令:
psql.exe -h 192.168.114.12 -p 5432 -d db_seros_transaccion -U postgres -f script.sql
错误:
psql: FATAL: la conversión entre WIN1252 y LATIN1 no está soportada
我尝试添加句子
SET client_encoding = 'UTF8';
但是问题依然存在(以及其他编码,如LATIN1& WIN1252)。
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.
任何人都可以帮助我使用 psql 建立连接,而无需更新?是否有可能?
Can anyone help me to make a connection using psql without an update? Is it possible?
非常感谢并借口我的英语。
Thanks a lot and excuse my English.
推荐答案
p>非常感谢 Craig Ringer ,工作,终于成功了!你现在是我的新偶像!
Thanks a lot Craig Ringer, works, finally works! You are my new idool now!
这些步骤是:
- 打开cmd
- SET PGCLIENTENCODING = utf-8
- chcp 65001
- psql -h 192.168.114.12 -U postgres
- open the cmd
- SET PGCLIENTENCODING=utf-8
- chcp 65001
- psql -h 192.168.114.12 -U postgres
这篇关于PostgreSQL:使用psql命令行实用程序时在Windows上的编码问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!