From 485fb56eb86a1fcd35fd3d0d37efb5ec514dba2b Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 13 Apr 2010 11:07:24 +0000 Subject: 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 --- Lib/pickletools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Lib/pickletools.py') diff --git a/Lib/pickletools.py b/Lib/pickletools.py index ca11aa3871..6ab75c7ab7 100644 --- a/Lib/pickletools.py +++ b/Lib/pickletools.py @@ -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))) -- cgit v1.2.1