Need to use surrogate escape here too I think

If bytes get passed in they are escaped using escape_bytes with a `surrogateescape` but then are not encoded properly here without this change.  This seems to fix the issue for me.
This commit is contained in:
Will James
2015-02-28 16:41:15 +11:00
parent a8556bd77e
commit ec2d301440

View File

@@ -760,7 +760,10 @@ class Connection(object):
#if DEBUG:
# print("DEBUG: sending query:", sql)
if isinstance(sql, text_type) and not (JYTHON or IRONPYTHON):
sql = sql.encode(self.encoding)
if PY2:
sql = sql.encode(self.encoding)
else:
sql = sql.encode(self.encoding, 'surrogateescape')
self._execute_command(COMMAND.COM_QUERY, sql)
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
return self._affected_rows