mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-27 11:10:19 -06:00
Fix dropping of databases with Unicode names. Fixes #2243
1. Pickup correct encoding in qtLiteral to decode. 2. While releasing database connection only decode database name if it's not unicode.
This commit is contained in:
parent
648c332488
commit
e4134695e5
@ -1576,7 +1576,8 @@ WHERE db.oid = {0}""".format(did))
|
|||||||
if did is not None:
|
if did is not None:
|
||||||
if did in self.db_info and 'datname' in self.db_info[did]:
|
if did in self.db_info and 'datname' in self.db_info[did]:
|
||||||
database = self.db_info[did]['datname']
|
database = self.db_info[did]['datname']
|
||||||
if hasattr(str, 'decode'):
|
if hasattr(str, 'decode') and \
|
||||||
|
not isinstance(database, unicode):
|
||||||
database = database.decode('utf-8')
|
database = database.decode('utf-8')
|
||||||
if database is None:
|
if database is None:
|
||||||
return False
|
return False
|
||||||
@ -1838,10 +1839,7 @@ class Driver(BaseDriver):
|
|||||||
# Returns in bytes, we need to convert it in string
|
# Returns in bytes, we need to convert it in string
|
||||||
if isinstance(res, bytes):
|
if isinstance(res, bytes):
|
||||||
try:
|
try:
|
||||||
try:
|
res = res.decode()
|
||||||
res = res.decode()
|
|
||||||
except UnicodeDecodeError:
|
|
||||||
res = res.decode(sys.getfilesystemencoding())
|
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
res = res.decode('utf-8')
|
res = res.decode('utf-8')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user