Skip to content

Commit a1fd168

Browse files
authored
Merge pull request #190 from kjd/unicode-16
Unicode 16
2 parents d5b7696 + 7732c61 commit a1fd168

File tree

4 files changed

+1010
-746
lines changed

4 files changed

+1010
-746
lines changed

idna/core.py

+46-8
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,45 @@
99
_virama_combining_class = 9
1010
_alabel_prefix = b"xn--"
1111
_unicode_dots_re = re.compile("[\u002e\u3002\uff0e\uff61]")
12+
_ldh = (
13+
48,
14+
49,
15+
50,
16+
51,
17+
52,
18+
53,
19+
54,
20+
55,
21+
56,
22+
57,
23+
95,
24+
97,
25+
98,
26+
99,
27+
100,
28+
101,
29+
102,
30+
103,
31+
104,
32+
105,
33+
106,
34+
107,
35+
108,
36+
109,
37+
110,
38+
111,
39+
112,
40+
113,
41+
114,
42+
115,
43+
116,
44+
117,
45+
118,
46+
119,
47+
120,
48+
121,
49+
122,
50+
)
1251

1352

1453
class IDNAError(UnicodeError):
@@ -341,17 +380,16 @@ def uts46_remap(domain: str, std3_rules: bool = True, transitional: bool = False
341380
uts46row = uts46data[code_point if code_point < 256 else bisect.bisect_left(uts46data, (code_point, "Z")) - 1]
342381
status = uts46row[1]
343382
replacement: Optional[str] = None
383+
if std3_rules and code_point <= 0x7F:
384+
if code_point not in _ldh:
385+
raise InvalidCodepoint(
386+
"Codepoint {} at position {} does not follow STD3 rules".format(_unot(code_point), pos + 1)
387+
)
344388
if len(uts46row) == 3:
345389
replacement = uts46row[2]
346-
if (
347-
status == "V"
348-
or (status == "D" and not transitional)
349-
or (status == "3" and not std3_rules and replacement is None)
350-
):
390+
if status == "V" or (status == "D" and not transitional):
351391
output += char
352-
elif replacement is not None and (
353-
status == "M" or (status == "3" and not std3_rules) or (status == "D" and transitional)
354-
):
392+
elif replacement is not None and (status == "M" or (status == "D" and transitional)):
355393
output += replacement
356394
elif status != "I":
357395
raise IndexError()

idna/idnadata.py

+72-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# This file is automatically generated by tools/idna-data
22

3-
__version__ = "15.1.0"
3+
__version__ = "16.0.0"
4+
45
scripts = {
56
"Greek": (
67
0x37000000374,
@@ -727,6 +728,7 @@
727728
0x88C: 68,
728729
0x88D: 68,
729730
0x88E: 82,
731+
0x897: 84,
730732
0x898: 84,
731733
0x899: 84,
732734
0x89A: 84,
@@ -1873,8 +1875,17 @@
18731875
0x10D25: 84,
18741876
0x10D26: 84,
18751877
0x10D27: 84,
1878+
0x10D69: 84,
1879+
0x10D6A: 84,
1880+
0x10D6B: 84,
1881+
0x10D6C: 84,
1882+
0x10D6D: 84,
18761883
0x10EAB: 84,
18771884
0x10EAC: 84,
1885+
0x10EC2: 82,
1886+
0x10EC3: 68,
1887+
0x10EC4: 68,
1888+
0x10EFC: 84,
18781889
0x10EFD: 84,
18791890
0x10EFE: 84,
18801891
0x10EFF: 84,
@@ -2053,6 +2064,17 @@
20532064
0x11372: 84,
20542065
0x11373: 84,
20552066
0x11374: 84,
2067+
0x113BB: 84,
2068+
0x113BC: 84,
2069+
0x113BD: 84,
2070+
0x113BE: 84,
2071+
0x113BF: 84,
2072+
0x113C0: 84,
2073+
0x113CE: 84,
2074+
0x113D0: 84,
2075+
0x113D2: 84,
2076+
0x113E1: 84,
2077+
0x113E2: 84,
20562078
0x11438: 84,
20572079
0x11439: 84,
20582080
0x1143A: 84,
@@ -2108,7 +2130,6 @@
21082130
0x116B5: 84,
21092131
0x116B7: 84,
21102132
0x1171D: 84,
2111-
0x1171E: 84,
21122133
0x1171F: 84,
21132134
0x11722: 84,
21142135
0x11723: 84,
@@ -2265,6 +2286,7 @@
22652286
0x11F3A: 84,
22662287
0x11F40: 84,
22672288
0x11F42: 84,
2289+
0x11F5A: 84,
22682290
0x13430: 84,
22692291
0x13431: 84,
22702292
0x13432: 84,
@@ -2297,6 +2319,21 @@
22972319
0x13453: 84,
22982320
0x13454: 84,
22992321
0x13455: 84,
2322+
0x1611E: 84,
2323+
0x1611F: 84,
2324+
0x16120: 84,
2325+
0x16121: 84,
2326+
0x16122: 84,
2327+
0x16123: 84,
2328+
0x16124: 84,
2329+
0x16125: 84,
2330+
0x16126: 84,
2331+
0x16127: 84,
2332+
0x16128: 84,
2333+
0x16129: 84,
2334+
0x1612D: 84,
2335+
0x1612E: 84,
2336+
0x1612F: 84,
23002337
0x16AF0: 84,
23012338
0x16AF1: 84,
23022339
0x16AF2: 84,
@@ -2605,6 +2642,8 @@
26052642
0x1E4ED: 84,
26062643
0x1E4EE: 84,
26072644
0x1E4EF: 84,
2645+
0x1E5EE: 84,
2646+
0x1E5EF: 84,
26082647
0x1E8D0: 84,
26092648
0x1E8D1: 84,
26102649
0x1E8D2: 84,
@@ -3328,7 +3367,7 @@
33283367
0x8600000086B,
33293368
0x87000000888,
33303369
0x8890000088F,
3331-
0x898000008E2,
3370+
0x897000008E2,
33323371
0x8E300000958,
33333372
0x96000000964,
33343373
0x96600000970,
@@ -3563,6 +3602,7 @@
35633602
0x1C0000001C38,
35643603
0x1C4000001C4A,
35653604
0x1C4D00001C7E,
3605+
0x1C8A00001C8B,
35663606
0x1CD000001CD3,
35673607
0x1CD400001CFB,
35683608
0x1D0000001D2C,
@@ -3926,11 +3966,13 @@
39263966
0xA7C30000A7C4,
39273967
0xA7C80000A7C9,
39283968
0xA7CA0000A7CB,
3969+
0xA7CD0000A7CE,
39293970
0xA7D10000A7D2,
39303971
0xA7D30000A7D4,
39313972
0xA7D50000A7D6,
39323973
0xA7D70000A7D8,
39333974
0xA7D90000A7DA,
3975+
0xA7DB0000A7DC,
39343976
0xA7F60000A7F8,
39353977
0xA7FA0000A828,
39363978
0xA82C0000A82D,
@@ -4000,6 +4042,7 @@
40004042
0x105A3000105B2,
40014043
0x105B3000105BA,
40024044
0x105BB000105BD,
4045+
0x105C0000105F4,
40034046
0x1060000010737,
40044047
0x1074000010756,
40054048
0x1076000010768,
@@ -4037,10 +4080,14 @@
40374080
0x10CC000010CF3,
40384081
0x10D0000010D28,
40394082
0x10D3000010D3A,
4083+
0x10D4000010D50,
4084+
0x10D6900010D6E,
4085+
0x10D6F00010D86,
40404086
0x10E8000010EAA,
40414087
0x10EAB00010EAD,
40424088
0x10EB000010EB2,
4043-
0x10EFD00010F1D,
4089+
0x10EC200010EC5,
4090+
0x10EFC00010F1D,
40444091
0x10F2700010F28,
40454092
0x10F3000010F51,
40464093
0x10F7000010F86,
@@ -4086,6 +4133,16 @@
40864133
0x1135D00011364,
40874134
0x113660001136D,
40884135
0x1137000011375,
4136+
0x113800001138A,
4137+
0x1138B0001138C,
4138+
0x1138E0001138F,
4139+
0x11390000113B6,
4140+
0x113B7000113C1,
4141+
0x113C2000113C3,
4142+
0x113C5000113C6,
4143+
0x113C7000113CB,
4144+
0x113CC000113D4,
4145+
0x113E1000113E3,
40894146
0x114000001144B,
40904147
0x114500001145A,
40914148
0x1145E00011462,
@@ -4100,6 +4157,7 @@
41004157
0x116500001165A,
41014158
0x11680000116B9,
41024159
0x116C0000116CA,
4160+
0x116D0000116E4,
41034161
0x117000001171B,
41044162
0x1171D0001172C,
41054163
0x117300001173A,
@@ -4123,6 +4181,8 @@
41234181
0x11A5000011A9A,
41244182
0x11A9D00011A9E,
41254183
0x11AB000011AF9,
4184+
0x11BC000011BE1,
4185+
0x11BF000011BFA,
41264186
0x11C0000011C09,
41274187
0x11C0A00011C37,
41284188
0x11C3800011C41,
@@ -4147,14 +4207,16 @@
41474207
0x11F0000011F11,
41484208
0x11F1200011F3B,
41494209
0x11F3E00011F43,
4150-
0x11F5000011F5A,
4210+
0x11F5000011F5B,
41514211
0x11FB000011FB1,
41524212
0x120000001239A,
41534213
0x1248000012544,
41544214
0x12F9000012FF1,
41554215
0x1300000013430,
41564216
0x1344000013456,
4217+
0x13460000143FB,
41574218
0x1440000014647,
4219+
0x161000001613A,
41584220
0x1680000016A39,
41594221
0x16A4000016A5F,
41604222
0x16A6000016A6A,
@@ -4167,6 +4229,8 @@
41674229
0x16B5000016B5A,
41684230
0x16B6300016B78,
41694231
0x16B7D00016B90,
4232+
0x16D4000016D6D,
4233+
0x16D7000016D7A,
41704234
0x16E6000016E80,
41714235
0x16F0000016F4B,
41724236
0x16F4F00016F88,
@@ -4176,7 +4240,7 @@
41764240
0x16FF000016FF2,
41774241
0x17000000187F8,
41784242
0x1880000018CD6,
4179-
0x18D0000018D09,
4243+
0x18CFF00018D09,
41804244
0x1AFF00001AFF4,
41814245
0x1AFF50001AFFC,
41824246
0x1AFFD0001AFFF,
@@ -4191,6 +4255,7 @@
41914255
0x1BC800001BC89,
41924256
0x1BC900001BC9A,
41934257
0x1BC9D0001BC9F,
4258+
0x1CCF00001CCFA,
41944259
0x1CF000001CF2E,
41954260
0x1CF300001CF47,
41964261
0x1DA000001DA37,
@@ -4214,6 +4279,7 @@
42144279
0x1E2900001E2AF,
42154280
0x1E2C00001E2FA,
42164281
0x1E4D00001E4FA,
4282+
0x1E5D00001E5FB,
42174283
0x1E7E00001E7E7,
42184284
0x1E7E80001E7EC,
42194285
0x1E7ED0001E7EF,

0 commit comments

Comments
 (0)