Fixed encoding issue when database encoding set to SQL_ASCII and name of the column is in ASCII character. Fixes #6018

This commit is contained in:
Rahul Shirsat 2021-02-26 13:23:07 +05:30 committed by Akshay Joshi
parent 5a5a9314f3
commit 87b9549ff4
4 changed files with 19 additions and 1 deletions

View File

@ -19,4 +19,5 @@ Bug fixes
| `Issue #4959 <https://redmine.postgresql.org/issues/4959>`_ - Fixed an issue where the properties tab for collection nodes is unresponsive after switching the tabs.
| `Issue #5073 <https://redmine.postgresql.org/issues/5073>`_ - Fixed an issue where the Save button is enabled for functions/procedures by default when open the properties dialog.
| `Issue #6018 <https://redmine.postgresql.org/issues/6018>`_ - Fixed encoding issue when database encoding set to SQL_ASCII and name of the column is in ASCII character.
| `Issue #6159 <https://redmine.postgresql.org/issues/6159>`_ - Ensure that the user should be able to kill the session from Dashboard if the user has a 'pg_signal_backend' role.

View File

@ -453,7 +453,9 @@ def poll(trans_id):
# Using characters %, (, ) in the argument names is not
# supported in psycopg2
col_info['pgadmin_alias'] = \
re.sub("[%()]+", "|", col_name)
re.sub("[%()]+", "|", col_name).\
encode('unicode_escape').decode('utf-8')
session_obj['columns_info'] = columns
# status of async_fetchmany_2darray is True and result is none

View File

@ -45,6 +45,13 @@ class TestEncodingCharset(BaseTestGenerator):
lc_collate='C',
test_str='Tif'
)),
(
'With Encoding SQL_ASCII (additional test)',
dict(
db_encoding='SQL_ASCII',
lc_collate='C',
test_str='ü'
)),
(
'With Encoding LATIN1',
dict(

View File

@ -55,6 +55,14 @@ class TestSQLASCIIEncoding(BaseTestGenerator):
lc_collate='C',
test_str='Blob: \xf4\xa5\xa3\xa5'
)),
(
'Test SQL_ASCII data with blob string & ascii table name',
dict(
table_name='ü',
db_encoding='SQL_ASCII',
lc_collate='C',
test_str='Blob: \xf4\xa5\xa3\xa5'
)),
]
def setUp(self):