Skip to content

Commit b375d27

Browse files
authored
Implement Unicode 16 (#208)
* Update to Unicode 16 test vectors * Update README to reflect transitional processing is gone * Pre-compute UTS46 tests as part of make-libdata * Don't use ruff to format tests * Remove extra UTS46 test vector * Omit vectors known to be broken in test suite
1 parent bfa6355 commit b375d27

8 files changed

Lines changed: 26784 additions & 7609 deletions

File tree

.github/workflows/python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
run: python -m pip install ruff mypy
3636
- name: Check code style with ruff
3737
run: |
38-
ruff format --check idna tests
38+
ruff format --check idna
3939
ruff check idna tests
4040
- name: Check types with mypy
4141
run: mypy --strict idna

README.rst

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,10 @@ ways a user may input a domain name. This functionality, known as
7979
a “mapping”, is considered by the specification to be a local
8080
user-interface issue distinct from IDNA conversion functionality.
8181

82-
This library provides one such mapping that was developed by the
83-
Unicode Consortium. Known as `Unicode IDNA Compatibility Processing
84-
<https://unicode.org/reports/tr46/>`_, it provides for both a regular
85-
mapping for typical applications, as well as a transitional mapping to
86-
help migrate from older IDNA 2003 applications. Strings are
87-
preprocessed according to Section 4.4 “Preprocessing for IDNA2008”
88-
prior to the IDNA operations.
82+
This library provides one such mapping — `Unicode IDNA Compatibility
83+
Processing <https://unicode.org/reports/tr46/>`_ developed by the Unicode
84+
Consortium. Strings are preprocessed according to Section 4.4
85+
“Preprocessing for IDNA2008” prior to the IDNA operations.
8986

9087
For example, “Königsgäßchen” is not a permissible label as *LATIN
9188
CAPITAL LETTER K* is not allowed (nor are capital letters in general).
@@ -103,24 +100,6 @@ conversion.
103100
>>> print(idna.decode('xn--knigsgchen-b4a3dun'))
104101
königsgäßchen
105102
106-
Transitional processing provides conversions to help transition from
107-
the older 2003 standard to the current standard. For example, in the
108-
original IDNA specification, the *LATIN SMALL LETTER SHARP S* (ß) was
109-
converted into two *LATIN SMALL LETTER S* (ss), whereas in the current
110-
IDNA specification this conversion is not performed.
111-
112-
.. code-block:: pycon
113-
114-
>>> idna.encode('Königsgäßchen', uts46=True, transitional=True)
115-
'xn--knigsgsschen-lcb0w'
116-
117-
Implementers should use transitional processing with caution, only in
118-
rare cases where conversion from legacy labels to current labels must be
119-
performed (i.e. IDNA implementations that pre-date 2008). For typical
120-
applications that just need to convert labels, transitional processing
121-
is unlikely to be beneficial and could produce unexpected incompatible
122-
results.
123-
124103
``encodings.idna`` Compatibility
125104
++++++++++++++++++++++++++++++++
126105

@@ -206,3 +185,7 @@ Additional Notes
206185
may wish to consider trying the encode/decode operation in this library
207186
first, and then falling back to using `encodings.idna`. See `the Github
208187
project <https://github.com/kjd/idna/issues/18>`_ for more discussion.
188+
189+
* **Transitional processing**. Unicode 16.0.0 removed transitional
190+
processing so the `transitional` argument for the encode() method
191+
no longer has any effect and will be removed at a later date.

idna/idnadata.py

Lines changed: 72 additions & 6 deletions
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)