INADA Naoki added the comment:
FYI, I found a workaround.
https://github.com/PyMySQL/PyMySQL/pull/409
_table = [chr(i) for i in range(128)] + [chr(i) for i in range(0xdc80, 0xdd00)]
def decode_surroundescape(s):
return s.decode('latin1').translate(_table)
In [15]: data = b'\xff' * 1024 * 1024
In [16]: data.decode('ascii', 'surrogateescape') == decode_surroundescape(data)
Out[16]: True
In [17]: %timeit data.decode('ascii', 'surrogateescape')
1 loops, best of 3: 394 ms per loop
In [18]: %timeit decode_surroundescape(data)
10 loops, best of 3: 40 ms per loop
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue24870>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com