Hi,

Here is patch for RM2243 and RM2244

Changes: 1. Pickup correct encoding in qtLiteral to decode.
2. While releasing database connection only decode database name if it's
not unicode.

-- 
*Harshal Dhumal*
*Software Engineer*

EnterpriseDB India: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/utils/driver/psycopg2/__init__.py b/web/pgadmin/utils/driver/psycopg2/__init__.py
index 18be00ed..ae133559 100644
--- a/web/pgadmin/utils/driver/psycopg2/__init__.py
+++ b/web/pgadmin/utils/driver/psycopg2/__init__.py
@@ -1576,7 +1576,8 @@ WHERE db.oid = {0}""".format(did))
         if did is not None:
             if did in self.db_info and 'datname' in self.db_info[did]:
                 database = self.db_info[did]['datname']
-                if hasattr(str, 'decode'):
+                if hasattr(str, 'decode') and \
+                        not isinstance(database, unicode):
                     database = database.decode('utf-8')
                 if database is None:
                     return False
@@ -1838,10 +1839,7 @@ class Driver(BaseDriver):
         # Returns in bytes, we need to convert it in string
         if isinstance(res, bytes):
             try:
-                try:
-                    res = res.decode()
-                except UnicodeDecodeError:
-                    res = res.decode(sys.getfilesystemencoding())
+                res = res.decode()
             except UnicodeDecodeError:
                 res = res.decode('utf-8')
 
-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers

Reply via email to