PostgreSql sql shell win10 下乱码解决

重现步骤:

打开 SQL Shell (psql)

1 Server [localhost]:
2 Database [postgres]:
3 Port [5432]:
4 Username [postgres]:
5 psql (9.6.2)
6 ê?è? "help" à′??è?°??úD??¢.
7 
8 postgres=#

解决办法:

打开环境变量窗口

cmd
rundll32 sysdm.cpl,EditEnvironmentVariables

设置环境变量

Path = PostgreSQL\9.6\bin (Add to existing system path)
PGCLIENTENCODING = UTF8

 

打开命令行

cmd.exe
chcp 65001

然后,再登陆

psql -U postgres postgres

 

至此问题解决。 为了方便后续使用, 在桌面上面创建一个 【openPsql.bat】 文件, 加入下面的内容,这样下次使用的时候,直接双击即可。

chcp 65001
psql -U postgres postgres

 

posted @ 2017-09-22 16:37  shareforever.999  阅读(1722)  评论(0编辑  收藏  举报