public inbox for [email protected]
help / color / mirror / Atom feedFrom: Murtuza Zabuawala <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: PATCH: Encoding issue with qtLiteral function (pgAdmin4)
Date: Fri, 22 Jul 2016 19:41:01 +0530
Message-ID: <CAKKotZR5b=JjkC5cS2x=TzVY2MfEhc+eHpcbMm41eW5jv4uYBA@mail.gmail.com> (raw)
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgadmin-hackers>
Hi,
PFA patch to fix the issue when we use qtLiteral function and user enters
special characters(like emojis) which it fails to handle.
RM#1307
--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
Attachments:
[application/octet-stream] RM_1307.patch (1.4K, 3-RM_1307.patch)
download | inline diff:
diff --git a/requirements_py2.txt b/requirements_py2.txt
index b205323..83ac8d3 100644
--- a/requirements_py2.txt
+++ b/requirements_py2.txt
@@ -21,7 +21,7 @@ linecache2==1.0.0
MarkupSafe==0.23
passlib==1.6.2
pbr==1.9.1
-psycopg2==2.5.2
+psycopg2==2.6.2
pycrypto==2.6.1
pyrsistent==0.11.13
python-dateutil==2.5.0
diff --git a/requirements_py3.txt b/requirements_py3.txt
index 463f79e..ad6fa02 100644
--- a/requirements_py3.txt
+++ b/requirements_py3.txt
@@ -20,7 +20,7 @@ linecache2==1.0.0
MarkupSafe==0.23
passlib==1.6.2
pbr==1.9.1
-psycopg2==2.5.2
+psycopg2==2.6.2
pycrypto==2.6.1
pyrsistent==0.11.13
python-dateutil==2.5.0
diff --git a/web/pgadmin/utils/driver/psycopg2/__init__.py b/web/pgadmin/utils/driver/psycopg2/__init__.py
index 7b901d4..9c76959 100644
--- a/web/pgadmin/utils/driver/psycopg2/__init__.py
+++ b/web/pgadmin/utils/driver/psycopg2/__init__.py
@@ -1564,9 +1564,13 @@ class Driver(BaseDriver):
@staticmethod
def qtLiteral(value):
-
- res = adapt(value).getquoted()
-
+ try:
+ res = adapt(value).getquoted()
+ except UnicodeEncodeError:
+ # We will handle special charcters with utf8 encoding
+ adapted = adapt(value)
+ adapted.encoding = 'utf8'
+ res = adapted.getquoted()
# Returns in bytes, we need to convert it in string
if isinstance(res, bytes):
return res.decode()
view thread (16+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: PATCH: Encoding issue with qtLiteral function (pgAdmin4)
In-Reply-To: <CAKKotZR5b=JjkC5cS2x=TzVY2MfEhc+eHpcbMm41eW5jv4uYBA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox