diff --git a/web/pgadmin/tools/sqleditor/__init__.py b/web/pgadmin/tools/sqleditor/__init__.py index 40442ff5e..0fa35ca06 100644 --- a/web/pgadmin/tools/sqleditor/__init__.py +++ b/web/pgadmin/tools/sqleditor/__init__.py @@ -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 diff --git a/web/pgadmin/tools/sqleditor/tests/test_encoding_charset.py b/web/pgadmin/tools/sqleditor/tests/test_encoding_charset.py index a0964cce3..c68c5fbbd 100644 --- a/web/pgadmin/tools/sqleditor/tests/test_encoding_charset.py +++ b/web/pgadmin/tools/sqleditor/tests/test_encoding_charset.py @@ -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( diff --git a/web/pgadmin/tools/sqleditor/tests/test_sql_ascii_encoding.py b/web/pgadmin/tools/sqleditor/tests/test_sql_ascii_encoding.py index a71dfaad0..e25769a9c 100644 --- a/web/pgadmin/tools/sqleditor/tests/test_sql_ascii_encoding.py +++ b/web/pgadmin/tools/sqleditor/tests/test_sql_ascii_encoding.py @@ -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):