Skip to content

Commit ee6ad1c

Browse files
committed
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: PyMySQL#90 .
1 parent ae9d6f8 commit ee6ad1c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

MySQLdb/cursors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ def callproc(self, procname, args=()):
358358
','.join(['@_%s_%d' % (procname, i)
359359
for i in range(len(args))]))
360360
if isinstance(q, unicode):
361-
q = q.encode(db.unicode_literal.charset)
361+
q = q.encode(db.unicode_literal.charset, 'surrogateescape')
362362
self._query(q)
363363
self._executed = q
364364
if not self._defer_warnings:

0 commit comments

Comments
 (0)