mirror of
https://github.com/python/cpython.git
synced 2026-04-23 12:21:01 +00:00
bpo-29456: Fix bugs in unicodedata.normalize: u1176, u11a7 and u11c3 (GH-1958)
Hangul composition check boundaries are wrong for the second character
([0x1161, 0x1176) instead of [0x1161, 0x1176]) and third character ((0x11A7, 0x11C3)
instead of [0x11A7, 0x11C3]).
(cherry picked from commit d134809cd3)
Co-authored-by: Wonsup Yoon <pusnow@me.com>
This commit is contained in:
parent
a50b825c18
commit
0e2b76ea4e
4 changed files with 22 additions and 3 deletions
|
|
@ -208,6 +208,19 @@ def test_issue10254(self):
|
|||
b = 'C\u0338' * 20 + '\xC7'
|
||||
self.assertEqual(self.db.normalize('NFC', a), b)
|
||||
|
||||
def test_issue29456(self):
|
||||
# Fix #29456
|
||||
u1176_str_a = '\u1100\u1176\u11a8'
|
||||
u1176_str_b = '\u1100\u1176\u11a8'
|
||||
u11a7_str_a = '\u1100\u1175\u11a7'
|
||||
u11a7_str_b = '\uae30\u11a7'
|
||||
u11c3_str_a = '\u1100\u1175\u11c3'
|
||||
u11c3_str_b = '\uae30\u11c3'
|
||||
self.assertEqual(self.db.normalize('NFC', u1176_str_a), u1176_str_b)
|
||||
self.assertEqual(self.db.normalize('NFC', u11a7_str_a), u11a7_str_b)
|
||||
self.assertEqual(self.db.normalize('NFC', u11c3_str_a), u11c3_str_b)
|
||||
|
||||
|
||||
def test_east_asian_width(self):
|
||||
eaw = self.db.east_asian_width
|
||||
self.assertRaises(TypeError, eaw, b'a')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue