diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-10-02 13:07:28 +0300 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-10-02 13:07:28 +0300 |
commit | 28b21e50c8f1bc9f4524b02df75b83f3b5efacb4 (patch) | |
tree | a4f79a50557f58e93c570be7e655516c2d2e894b /Lib/test/test_unicode.py | |
parent | 223349cfb8a7a59caf7dffee55f21c800bdb947d (diff) | |
download | cpython-git-28b21e50c8f1bc9f4524b02df75b83f3b5efacb4.tar.gz |
Issue #24848: Fixed bugs in UTF-7 decoding of misformed data:
1. Non-ASCII bytes were accepted after shift sequence.
2. A low surrogate could be emitted in case of error in high surrogate.
Diffstat (limited to 'Lib/test/test_unicode.py')
-rw-r--r-- | Lib/test/test_unicode.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index 5efbe3e42c..2cc1d7c3ff 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -1524,7 +1524,7 @@ class UnicodeTest(string_tests.CommonTest, self.assertEqual(b'+2AHab9ze-'.decode('utf-7'), '\uD801\U000abcde') # Issue #2242: crash on some Windows/MSVC versions - self.assertEqual(b'+\xc1'.decode('utf-7'), '\xc1') + self.assertEqual(b'+\xc1'.decode('utf-7', 'ignore'), '') # Direct encoded characters set_d = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'(),-./:?" @@ -1966,6 +1966,7 @@ class UnicodeTest(string_tests.CommonTest, self.assertRaises(UnicodeError, str, b'Andr\202 x', 'ascii', 'strict') self.assertEqual(str(b'Andr\202 x', 'ascii', 'ignore'), "Andr x") self.assertEqual(str(b'Andr\202 x', 'ascii', 'replace'), 'Andr\uFFFD x') + self.assertEqual(str(b'\202 x', 'ascii', 'replace'), '\uFFFD x') # Error handling (unknown character names) self.assertEqual(b"\\N{foo}xx".decode("unicode-escape", "ignore"), "xx") |