mirror of
https://github.com/python/cpython.git
synced 2025-10-07 15:42:02 +00:00
Issue #8383: pickle and pickletools use surrogatepass error handler when
encoding unicode as utf8 to support lone surrogates and stay compatible with Python 2.x and 3.0
This commit is contained in:
parent
3606760670
commit
485fb56eb8
5 changed files with 14 additions and 6 deletions
|
@ -469,7 +469,7 @@ def read_unicodestring4(f):
|
|||
raise ValueError("unicodestring4 byte count < 0: %d" % n)
|
||||
data = f.read(n)
|
||||
if len(data) == n:
|
||||
return str(data, 'utf-8')
|
||||
return str(data, 'utf-8', 'surrogatepass')
|
||||
raise ValueError("expected %d bytes in a unicodestring4, but only %d "
|
||||
"remain" % (n, len(data)))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue