summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2010-07-01 07:32:02 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2010-07-01 07:32:02 (GMT)
commit57221d02bad3fff71b9abe7aa564352506c94514 (patch)
tree2980078793efc178ce95a0b9aa81d35f82c962e6 /Misc
parentead3c83ea956bebed675c6c02f398d21b2fbeb62 (diff)
downloadcpython-57221d02bad3fff71b9abe7aa564352506c94514.zip
cpython-57221d02bad3fff71b9abe7aa564352506c94514.tar.gz
cpython-57221d02bad3fff71b9abe7aa564352506c94514.tar.bz2
Update PyUnicode_DecodeUTF8 from RFC 2279 to RFC 3629.
1) #8271: when a byte sequence is invalid, only the start byte and all the valid continuation bytes are now replaced by U+FFFD, instead of replacing the number of bytes specified by the start byte. See http://www.unicode.org/versions/Unicode5.2.0/ch03.pdf (pages 94-95); 2) 5- and 6-bytes-long UTF-8 sequences are now considered invalid (no changes in behavior); 3) Change the error messages "unexpected code byte" to "invalid start byte" and "invalid data" to "invalid continuation byte"; 4) Add an extensive set of tests in test_unicode; 5) Fix test_codeccallbacks because it was failing after this change.
Diffstat (limited to 'Misc')
-rw-r--r--Misc/NEWS8
1 files changed, 8 insertions, 0 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 78fe3fc..9cf23c3 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,14 @@ What's New in Python 3.2 Alpha 1?
Core and Builtins
-----------------
+- Issue #8271: during the decoding of an invalid UTF-8 byte sequence, only the
+ start byte and the continuation byte(s) are now considered invalid, instead
+ of the number of bytes specified by the start byte.
+ E.g.: '\xf1\x80AB'.decode('utf-8', 'replace') now returns u'\ufffdAB' and
+ replaces with U+FFFD only the start byte ('\xf1') and the continuation byte
+ ('\x80') even if '\xf1' is the start byte of a 4-bytes sequence.
+ Previous versions returned a single u'\ufffd'.
+
- Issue #9011: A negated imaginary literal (e.g., "-7j") now has real
part -0.0 rather than 0.0. So "-7j" is now exactly equivalent to
"-(7j)".