mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2025-08-16 03:50:43 +08:00
unicode string in argument of string raises error
Hi, I've got 'surrogates not allowed' error when I put unicode string into stored procedure's argument. This is pr for the issue. cf: https://github.com/PyMySQL/mysqlclient-python/issues/90 .
This commit is contained in:
@ -358,7 +358,7 @@ class BaseCursor(object):
|
|||||||
','.join(['@_%s_%d' % (procname, i)
|
','.join(['@_%s_%d' % (procname, i)
|
||||||
for i in range(len(args))]))
|
for i in range(len(args))]))
|
||||||
if isinstance(q, unicode):
|
if isinstance(q, unicode):
|
||||||
q = q.encode(db.unicode_literal.charset)
|
q = q.encode(db.unicode_literal.charset, 'surrogateescape')
|
||||||
self._query(q)
|
self._query(q)
|
||||||
self._executed = q
|
self._executed = q
|
||||||
if not self._defer_warnings:
|
if not self._defer_warnings:
|
||||||
|
Reference in New Issue
Block a user