mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2025-08-15 02:54:29 +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)
|
||||
for i in range(len(args))]))
|
||||
if isinstance(q, unicode):
|
||||
q = q.encode(db.unicode_literal.charset)
|
||||
q = q.encode(db.unicode_literal.charset, 'surrogateescape')
|
||||
self._query(q)
|
||||
self._executed = q
|
||||
if not self._defer_warnings:
|
||||
|
Reference in New Issue
Block a user