编码格式参数为client_encoding=“UTF-8”
连接时如下:
import psycopg2
conn = psycopg2.connect(dbname="test", user="user", password="password", port="5678", host="192.168.56.45", client_encoding="UTF-8")
client_encoding
This sets the client_encoding configuration parameter for this connection. In addition to the values accepted by the corresponding server option, you can use auto to determine the right encoding from the current locale in the client (LC_CTYPE environment variable on Unix systems).