mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-09 23:15:58 -06:00
Fix the UNICODE encoding issue while connecting through Pgbouncer after upgrading from 6.21 to 7.1 #6340.
This commit is contained in:
parent
07fa09f3c7
commit
a5b5ede8fd
@ -10,6 +10,7 @@
|
||||
# Get Postgres and Python encoding
|
||||
|
||||
import psycopg
|
||||
from flask import current_app
|
||||
|
||||
encode_dict = {
|
||||
'SQL_ASCII': ['SQL_ASCII', 'raw-unicode-escape'],
|
||||
@ -33,7 +34,12 @@ def get_encoding(key):
|
||||
#
|
||||
if key == 'ascii':
|
||||
key = 'raw_unicode_escape'
|
||||
postgres_encoding = psycopg._encodings.py2pgenc(key).decode()
|
||||
try:
|
||||
postgres_encoding = psycopg._encodings.py2pgenc(key).decode()
|
||||
except Exception as e:
|
||||
# For unsupported encodings by psycopg like UNICODE
|
||||
current_app.logger.error(e)
|
||||
postgres_encoding = 'utf-8'
|
||||
|
||||
python_encoding = psycopg._encodings._py_codecs.get(postgres_encoding,
|
||||
'utf-8')
|
||||
|
Loading…
Reference in New Issue
Block a user