psql:Windows 10 上奇怪的错误输出编码

问题描述 投票:0回答:1

每当我在 psql 中出现语法错误时,无论问题是什么,psql 都只显示:

ERROR:  character with byte sequence 0xd0 0x9e in encoding "UTF8" has no equivalent in encoding "WIN1252"

没有具体说明问题。

我正在本地主机上进行。

我尝试将代码页更改为utf8(通过

chcp 65001
)并在psql本身中使用
SET CLIENT_ENCODING TO 'utf8'
。之后,会显示错误,但采用奇怪的编码。我需要它来显示英文错误。

设置

chcp 65001
并使用
SET CLIENT_ENCODING TO 'utf8'
后得到的错误输出:

Error output I get after setting chcp 65001 and using

我在不执行这两项操作的情况下得到的错误输出:

Error output I get without doing both of those

编辑:通过运行“ncoding UTF8”和“set lc_messages to 'en_us.utf-8';”,它现在显示正确编码中的错误。感谢豪尔赫·坎波斯。

postgresql windows character-encoding psql
1个回答
0
投票

如果您已将 PostgreSQL 配置为发送俄语错误消息,请勿将客户端编码设置为

WIN1252
,因为西里尔字母无法转换为该编码。

您应该在

lc_messages = C
中设置
postgresql.conf
并重新加载PostgreSQL以获取英文错误消息。

© www.soinside.com 2019 - 2024. All rights reserved.