The encoding are support in PostgreSQL allows us to store text in a variety of encodings, including single-bytes encoding and multiple-byte encoding. All supported encoding can be used transparently by clients and server.
We can find encoding of table in PostgresSQL by inspecting the connection.encoding parameters. To change encoding, there is a method called connection.set_client_encoding().
import psycopg2
conn = psycopg2.connect("dbname=db user=ur")
cursor = conn.cursor()
encoding = conn.encoding
print(f"Current encoding is {encoding}")
# Convert encoding into other
conn.set_client_encoding('EUC-KR')
Source from : https://www.postgresql.org/docs/current/multibyte.html
'DB > PostgreSQL' 카테고리의 다른 글
[psycopg2] User Management (0) | 2022.09.29 |
---|---|
[psycopg2] Loading and Extracting Data with Tables (0) | 2022.09.28 |
[psycopg2] SQL Injection and Ways to defened it (0) | 2022.09.28 |
[psycopg2] Optimizing Data Types of Tables (0) | 2022.09.27 |
[psycopg2] SQL Transactions (1) | 2022.09.26 |