1 /* tst_idna2.c --- Self tests for idna_to_ascii_8z().
2 * Copyright (C) 2002, 2003, 2004 Simon Josefsson
4 * This file is part of GNU Libidn.
6 * GNU Libidn is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * GNU Libidn is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GNU Libidn; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
41 static const struct idna idna
[] = {
42 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xc3\xad\x64\x6e", "example.xn--dn-mja"
43 /* 1-1-1 Has an IDN in just the TLD */
45 {"\xc3\xab\x78\x2e\xc3\xad\x64\x6e", "xn--x-ega.xn--dn-mja"
46 /* 1-1-2 Has an IDN in the TLD and SLD */
48 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xc3\xa5\xc3\xbe\xc3\xa7",
50 /* 1-2-1 Latin-1 TLD */
52 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xc4\x83\x62\xc4\x89",
54 /* 1-2-2 Latin Extended A TLD */
56 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xc8\xa7\xc6\x80\xc6\x88",
58 /* 1-2-3 Latin Extended B TLD */
60 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xe1\xb8\x81\xe1\xb8\x83\xe1\xb8\x89",
62 /* 1-2-4 Latin Extended Additional TLD */
64 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xe4\xb8\xbf\xe4\xba\xba\xe5\xb0\xb8",
65 "example.xn--xiqplj17a"
68 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xe3\x81\x8b\xe3\x81\x8c\xe3\x81\x8d",
70 /* 1-3-2 Hiragana TLD */
72 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xe3\x82\xab\xe3\x82\xac\xe3\x82\xad",
74 /* 1-3-3 Katakana TLD */
76 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xe1\x84\x80\xe1\x85\xa1\xe1\x86\xa8",
78 /* 1-3-4 Hangul Jamo TLD */
79 /* Don't resolve as example.xn--ypd8qrh */
81 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xea\xb1\xa9\xeb\x93\x86\xec\x80\xba",
82 "example.xn--o69aq2nl0j"
83 /* 1-3-5 Hangul TLD */
85 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xea\x80\x8a\xea\x80\xa0\xea\x8a\xb8",
86 "example.xn--6l7arby7j"
89 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xce\xb1\xce\xb2\xce\xb3",
93 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xe1\xbc\x82\xe1\xbc\xa6\xe1\xbd\x95",
95 /* 1-3-8 Greek Extended TLD */
97 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xd0\xb0\xd0\xb1\xd0\xb2",
99 /* 1-3-9 Cyrillic TLD */
101 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xd5\xa1\xd5\xa2\xd5\xa3",
103 /* 1-3-10 Armeian TLD */
105 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xe1\x83\x90\xe1\x83\x91\xe1\x83\x92",
107 /* 1-3-11 Georgian TLD */
109 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xe2\x88\xa1\xe2\x86\xba\xe2\x8a\x82",
110 "example.xn--b7gxomk"
111 /* 1-4-1 Symbols TLD */
113 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xe0\xa4\x95\xe0\xa4\x96\xe0\xa4\x97",
115 /* 1-5-1 Devanagari TLD */
117 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xe0\xa6\x95\xe0\xa6\x96\xe0\xa6\x97",
119 /* 1-5-2 Bengali TLD */
121 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xe0\xa8\x95\xe0\xa8\x96\xe0\xa8\x97",
123 /* 1-5-3 Gurmukhi TLD */
125 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xe0\xaa\x95\xe0\xaa\x96\xe0\xaa\x97",
127 /* 1-5-4 Gujarati TLD */
129 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xe0\xac\x95\xe0\xac\x96\xe0\xac\x97",
131 /* 1-5-5 Oriya TLD */
133 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xe0\xae\x95\xe0\xae\x99\xe0\xae\x9a",
135 /* 1-5-6 Tamil TLD */
137 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xe0\xb0\x95\xe0\xb0\x96\xe0\xb0\x97",
139 /* 1-5-7 Telugu TLD */
141 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xe0\xb2\x95\xe0\xb2\x96\xe0\xb2\x97",
143 /* 1-5-8 Kannada TLD */
145 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xe0\xb4\x95\xe0\xb4\x96\xe0\xb4\x97",
147 /* 1-5-9 Malayalam TLD */
149 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xe0\xb6\x9a\xe0\xb6\x9b\xe0\xb6\x9c",
151 /* 1-5-10 Sinhala TLD */
153 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xe0\xb8\x81\xe0\xb8\x82\xe0\xb8\x83",
155 /* 1-5-11 Thai TLD */
157 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xe0\xba\x81\xe0\xba\x82\xe0\xba\x84",
161 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xe0\xbd\x80\xe0\xbd\x81\xe0\xbd\x82",
163 /* 1-5-13 Tibetan TLD */
165 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xe1\x80\x80\xe1\x80\x81\xe1\x80\x82",
167 /* 1-5-14 Myanmar TLD */
169 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xe1\x9e\x80\xe1\x9e\x81\xe1\x9e\x82",
171 /* 1-5-15 Khmer TLD */
173 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xe1\xa0\xa0\xe1\xa0\xa1\xe1\xa0\xa2",
175 /* 1-5-16 Mongolian TLD */
177 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xd8\xa7\xd8\xa8\xd8\xa9",
179 /* 1-6-1 Arabic TLD */
181 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xd7\x90\xd7\x91\xd7\x92",
183 /* 1-6-2 Hebrew TLD */
185 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xdc\x90\xdc\x91\xdc\x92",
187 /* 1-6-3 Syriac TLD */
189 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\x61\x62\x63\xe3\x82\xab\xe3\x82\xac\xe3\x82\xad",
190 "example.xn--abc-mj4bfg"
191 /* 1-7-1 ASCII and non-Latin TLD */
193 {"\x65\x78\x61\x6d\x70\x6c\x65\x2e\xc3\xa5\xc3\xbe\xc3\xa7\xe3\x82\xab\xe3\x82\xac\xe3\x82\xad",
194 "example.xn--5cae2e328wfag"
195 /* 1-7-2 Latin (non-ASCII) and non-Latin TLD */
197 {"\xc3\xad\x21\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65", ""
198 /* 2-3-1-1 Includes ! before Nameprep */
199 /* Don't resolve as xn--!dn-qma.example */
201 {"\xc3\xad\x24\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65", ""
202 /* 2-3-1-2 Includes $ before Nameprep */
203 /* Don't resolve as xn--$dn-qma.example */
205 {"\xc3\xad\x2b\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65", ""
206 /* 2-3-1-3 Includes + before Nameprep */
207 /* Don't resolve as xn--+dn-qma.example */
209 {"\x2d\xc3\xad\x31\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65", ""
210 /* 2-3-2-1 Leading hyphen before Nameprep */
211 /* Don't resolve as xn---1dn-vpa.example */
213 {"\xc3\xad\x31\x64\x6e\x2d\x2e\x65\x78\x61\x6d\x70\x6c\x65", ""
214 /* 2-3-2-2 Trailing hyphen before Nameprep */
215 /* Don't resolve as xn--1dn--upa.example */
217 {"\xc3\xad\xef\xbc\x8b\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65", ""
218 /* 2-3-3-1 Gets a + after Nameprep */
219 /* Don't resolve as xn--dn-mja0331x.example */
221 {"\xc3\xad\xe2\x81\xbc\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65", ""
222 /* 2-3-3-2 Gets a = after Nameprep */
223 /* Don't resolve as xn--dn-mja0343a.example */
225 {"\xef\xb9\xa3\xc3\xad\x32\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65", ""
226 /* 2-3-4-1 Leading hyphen after Nameprep */
227 /* Don't resolve as xn--2dn-qma32863a.example */
228 /* Don't resolve as xn---2dn-vpa.example */
230 {"\xc3\xad\x32\x64\x6e\xef\xbc\x8d\x2e\x65\x78\x61\x6d\x70\x6c\x65", ""
231 /* 2-3-4-2 Trailing hyphen after Nameprep */
232 /* Don't resolve as xn--2dn-qma79363a.example */
233 /* Don't resolve as xn--2dn--upa.example */
235 {"\xc2\xb9\x31\x2e\x65\x78\x61\x6d\x70\x6c\x65", "11.example"
236 /* 2-4-1 All-ASCII check, Latin */
238 {"\xe2\x85\xa5\x76\x69\x2e\x65\x78\x61\x6d\x70\x6c\x65", "vivi.example"
239 /* 2-4-2 All-ASCII check, symbol */
241 {"\xc3\x9f\x73\x73\x2e\x65\x78\x61\x6d\x70\x6c\x65", "ssss.example"
242 /* 2-4-3 All-ASCII check, sharp S */
244 {"\x78\x6e\x2d\x2d\xc3\xaf\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65", ""
245 /* 2-5-1 ACE prefix before Nameprep, body */
246 /* Don't resolve as xn--xn--dn-sja.example */
247 /* Don't resolve as xn--dn-sja.example */
249 {"\xe2\x85\xb9\x6e\x2d\x2d\xc3\xa4\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65",
251 /* 2-5-2 ACE prefix before Nameprep, prefix */
252 /* Don't resolve as xn--xn--dn-uia.example */
253 /* Don't resolve as xn--dn-uia.example */
256 /* 2-8-1 Zero-length label after Nameprep */
257 /* Don't resolve as xn--kba.example */
258 /* Don't resolve as xn--.example */
260 {"\x33\x30\x30\x32\x2d\x74\x65\x73\x74\xe3\x80\x82\xc3\xad\x64\x6e",
261 "3002-test.xn--dn-mja"
262 /* 2-9-1 U+3002 acts as a label separator */
263 /* Don't resolve as xn--3002-testdn-wcb2087m.example */
265 {"\x66\x66\x30\x65\x2d\x74\x65\x73\x74\xef\xbc\x8e\xc3\xad\x64\x6e",
266 "ff0e-test.xn--dn-mja"
267 /* 2-9-2 U+FF0E acts as a label separator */
268 /* Don't resolve as xn--ff0e-testdn-wcb45865f.example */
270 {"\x66\x66\x36\x31\x2d\x74\x65\x73\x74\xef\xbd\xa1\xc3\xad\x64\x6e",
271 "ff61-test.xn--dn-mja"
272 /* 2-9-3 U+FF61 acts as a label separator */
273 /* Don't resolve as xn--ff61-testdn-wcb33975f.example */
275 {"\x30\x30\x61\x64\x6f\x75\x74\xc2\xad\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65",
276 "xn--00adoutdn-m5a.example"
277 /* 4-1-1-1 00adout<00AD><00ED>dn.example -> 00adout<00ED>dn.example */
278 /* Don't resolve as xn--00adoutdn-cna81e.example */
280 {"\x32\x30\x30\x64\x6f\x75\x74\xe2\x80\x8d\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65",
281 "xn--200doutdn-m5a.example"
282 /* 4-1-1-2 200dout<200D><00ED>dn.example -> 200dout<00ED>dn.example */
283 /* Don't resolve as xn--200doutdn-m5a1678f.example */
285 {"\x73\x69\x6d\x70\x6c\x65\x63\x61\x70\x44\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65",
286 "xn--simplecapddn-1fb.example"
287 /* 4-1-2-1 simplecap<0044><00ED>dn.example -> simplecap<0064><00ED>dn.example */
289 {"\x6c\x61\x74\x69\x6e\x74\x6f\x67\x72\x65\x65\x6b\xc2\xb5\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65",
290 "xn--latintogreekdn-cmb716i.example"
291 /* 4-1-2-2 latintogreek<00B5><00ED>dn.example -> latintogreek<03BC><00ED>dn.example */
292 /* Don't resolve as xn--latintogreekdn-cxa01g.example */
294 {"\x6c\x61\x74\x69\x6e\x65\x78\x74\xc3\x87\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65",
295 "xn--latinextdn-v6a6e.example"
296 /* 4-1-2-3 latinext<00C7><00ED>dn.example -> latinext<00E7><00ED>dn.example */
297 /* Don't resolve as xn--latinextdn-twa07b.example */
299 {"\x73\x68\x61\x72\x70\x73\xc3\x9f\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65",
300 "xn--sharpsssdn-r8a.example"
301 /* 4-1-2-4 sharps<00DF><00ED>dn.example -> sharpsss<00ED>dn.example */
302 /* Don't resolve as xn--sharpsdn-vya4l.example */
304 {"\x74\x75\x72\x6b\x69\x73\x68\x69\xc4\xb0\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65",
305 "xn--turkishiidn-wcb701e.example"
306 /* 4-1-2-5 turkishi<0130><00ED>dn.example -> turkishi<0069><0307><00ED>dn.example */
307 /* Don't resolve as xn--turkishidn-r8a71f.example */
309 {"\x65\x78\x70\x74\x77\x6f\xc5\x89\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65",
310 "xn--exptwondn-m5a502c.example"
311 /* 4-1-2-6 exptwo<0149><00ED>dn.example -> exptwo<02BC><006E><00ED>dn.example */
312 /* Don't resolve as xn--exptwodn-h2a33g.example */
314 {"\x61\x64\x64\x66\x6f\x6c\x64\xcf\x92\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65",
315 "xn--addfolddn-m5a121f.example"
316 /* 4-1-2-7 addfold<03D2><00ED>dn.example -> addfold<03C5><00ED>dn.example */
317 /* Don't resolve as xn--addfolddn-m5a462f.example */
319 {"\x65\x78\x70\x74\x68\x72\x65\x65\xe1\xbd\x92\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65",
320 "xn--expthreedn-r8a5844g.example"
321 /* 4-1-2-8 expthree<1F52><00ED>dn.example -> expthree<03C5><0313><0300><00ED>dn.example */
323 {"\x6e\x6f\x6e\x62\x6d\x70\xf0\x90\x90\x80\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65",
324 "xn--nonbmpdn-h2a34747d.example"
325 /* 4-1-2-9 nonbmp<10400><00ED>dn.example -> nonbmp<10428><00ED>dn.example */
326 /* Don't resolve as xn--nonbmpdn-h2a37046d.example */
328 {"\x6e\x6f\x6e\x62\x6d\x70\x74\x6f\x61\x73\x63\x69\x69\xf0\x9d\x90\x80\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65",
329 "xn--nonbmptoasciiadn-msb.example"
330 /* 4-1-2-10 nonbmptoascii<1D400><00ED>dn.example -> nonbmptoasciia<00ED>dn.example */
331 /* Don't resolve as xn--nonbmptoasciidn-hpb54112i.example */
333 {"\x72\x65\x67\x63\x6f\x6d\x62\x65\xcc\x81\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65",
334 "xn--regcombdn-h4a8b.example"
335 /* 4-2-1-1 regcomb<0065><0301><00ED>dn.example -> regcomb<00E9><00ED>dn.example */
336 /* Don't resolve as xn--regcombedn-r8a794d.example */
338 {"\x63\x6f\x6d\x62\x61\x6e\x64\x63\x61\x73\x65\x45\xcc\x81\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65",
339 "xn--combandcasedn-lhb4d.example"
340 /* 4-2-1-2 combandcase<0045><0301><00ED>dn.example -> combandcase<00E9><00ED>dn.example */
341 /* Don't resolve as xn--combandcaseedn-cmb526f.example */
343 {"\x61\x64\x6a\x63\x6f\x6d\x62\xc2\xba\xcc\x81\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65",
344 "xn--adjcombdn-m5a9d.example"
345 /* 4-2-1-3 adjcomb<00BA><0301><00ED>dn.example -> adjcomb<00F3><00ED>dn.example */
346 /* Don't resolve as xn--adjcombdn-1qa57cp3r.example */
348 {"\x65\x78\x74\x63\x6f\x6d\x62\x6f\x63\xcc\x81\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65",
349 "xn--extcombodn-r8a52a.example"
350 /* 4-2-1-4 extcombo<0063><0301><00ED>dn.example -> extcombo<0107><00ED>dn.example */
351 /* Don't resolve as xn--extcombocdn-wcb920e.example */
353 {"\x64\x6f\x75\x62\x6c\x65\x64\x69\x61\x63\x31\x75\xcc\x88\xcc\x81\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65",
354 "xn--doublediac1dn-6ib836a.example"
355 /* 4-2-1-5 doublediac1<0075><0308><0301><00ED>dn.example -> doublediac2<01D8><00ED>dn.example */
356 /* Don't resolve as xn--doublediac1udn-cmb526fnd.example */
358 {"\x64\x6f\x75\x62\x6c\x65\x64\x69\x61\x63\x32\x75\xcc\x81\xcc\x88\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65",
359 "xn--doublediac2dn-6ib8qs73a.example"
360 /* 4-2-1-6 doublediac2<0075><0301><0308><00ED>dn.example -> doublediac2<01D8><00ED>dn.example */
361 /* Don't resolve as xn--doublediac2udn-cmb526fod.example */
363 {"\x6e\x65\x77\x6e\x6f\x72\x6d\xf0\xaf\xa1\xb4\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65",
364 "xn--newnormdn-m5a7856x.example"
365 /* 4-2-2-1 newnorm<2F874><00ED>dn.example -> newnorm<5F33><00ED>dn.example should not become <5F53> */
366 /* Don't resolve as xn--newnormdn-m5a9396x.example */
367 /* Don't resolve as xn--newnormdn-m5a9968x.example */
369 {"\xe2\x80\x80\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65", ""
371 /* Don't resolve as xn--dn-mja3392a.example */
373 {"\xdb\x9d\xc3\xad\x64\x6e\x2d\x32\x2e\x65\x78\x61\x6d\x70\x6c\x65", ""
375 /* Don't resolve as xn--dn-2-upa332g.example */
377 {"\xee\x80\x85\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65", ""
378 /* 4-3-3 Private use */
379 /* Don't resolve as xn--dn-mja1659t.example */
381 {"\xf3\xb0\x80\x85\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65", ""
382 /* 4-3-4 Private use, non-BMP */
383 /* Don't resolve as xn--dn-mja7922x.example */
385 {"\xef\xb7\x9d\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65", ""
386 /* 4-3-5 Non-character */
387 /* Don't resolve as xn--dn-mja1210x.example */
389 {"\xf0\x9f\xbf\xbe\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65", ""
390 /* 4-3-6 Non-character, non-BMP */
391 /* Don't resolve as xn--dn-mja7922x.example */
393 {"\xef\xbf\xbd\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65", ""
394 /* 4-3-7 Surrogate points */
395 /* Don't resolve as xn--dn-mja7922x.example */
397 {"\xef\xbf\xba\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65", ""
398 /* 4-3-8 Inappropriate for plain */
399 /* Don't resolve as xn--dn-mja5822x.example */
401 {"\xe2\xbf\xb5\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65", ""
402 /* 4-3-9 Inappropriate for canonical */
403 /* Don't resolve as xn--dn-mja3729b.example */
405 {"\xe2\x81\xaa\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65", ""
406 /* 4-3-10 Change display simple */
407 /* Don't resolve as xn--dn-mja7533a.example */
409 {"\xe2\x80\x8f\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65", ""
410 /* 4-3-11 Change display RTL */
411 /* Don't resolve as xn--dn-mja3992a.example */
413 {"\xf3\xa0\x80\x81\xf3\xa0\x81\x85\xf3\xa0\x81\x8e\x68\x69\x69\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65",
415 /* 4-3-12 Language tags */
416 /* Don't resolve as xn--hiidn-km43aaa.example */
418 {"\xd8\xa8\x6f\xd8\xb8\x2e\x65\x78\x61\x6d\x70\x6c\x65", ""
419 /* 4-4-1 Arabic RandALCat-LCat-RandALCat */
420 /* Don't resolve as xn--o-0mc3c.example */
422 {"\xd8\xa8\xd8\xb8\x6f\x2e\x65\x78\x61\x6d\x70\x6c\x65", ""
423 /* 4-4-2 Arabic RandALCat-RandALCat-other */
424 /* Don't resolve as xn--o-0mc2c.example */
426 {"\x6f\xd8\xa8\xd8\xb8\x2e\x65\x78\x61\x6d\x70\x6c\x65", ""
427 /* 4-4-3 Arabic other-RandALCat-RandALCat */
428 /* Don't resolve as xn--o-1mc2c.example */
430 {"\xd7\x91\x6f\xd7\xa1\x2e\x65\x78\x61\x6d\x70\x6c\x65", ""
431 /* 4-4-4 Hebrew RandALCat-LCat-RandALCat */
432 /* Don't resolve as xn--o-1hc3c.example */
434 {"\xd7\x91\xd7\xa1\x6f\x2e\x65\x78\x61\x6d\x70\x6c\x65", ""
435 /* 4-4-5 Hebrew RandALCat-RandALCat-other */
436 /* Don't resolve as xn--o-1hc2c.example */
438 {"\x6f\xd7\x91\xd7\xa1\x2e\x65\x78\x61\x6d\x70\x6c\x65", ""
439 /* 4-4-6 Hebrew other-RandALCat-RandALCat */
440 /* Don't resolve as xn--o-2hc2c.example */
442 {"\xc8\xb7\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65",
443 "xn--dn-mja33k.example"
444 /* 5-1-1 Unassigned in BMP; zone editors should reject */
446 {"\xf0\x90\x88\x85\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65",
447 "xn--dn-mja7734x.example"
448 /* 5-1-2 Unassinged outside BMP; zone editors should reject */
449 /* Don't resolve as xn--dn-mja7922x.example */
451 {"\xc8\xb4\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65",
452 "xn--dn-mja12k.example"
453 /* 5-2-1 Newly assigned in BMP; zone editors should reject */
455 {"\xf0\x90\x80\x85\xc3\xad\x64\x6e\x2e\x65\x78\x61\x6d\x70\x6c\x65",
456 "xn--dn-mja9232x.example"
457 /* 5-2-2 Newly assigned outside of BMP; zone editors should reject */
458 /* Don't resolve as xn--dn-mja7922x.example */
469 for (i
= 0; i
< sizeof (idna
) / sizeof (idna
[0]); i
++)
472 printf ("IDNA2 entry %d\n", i
);
476 printf ("in: %s\n", idna
[i
].in
);
477 hexprint (idna
[i
].in
, strlen (idna
[i
].in
));
478 escapeprint (idna
[i
].in
, strlen (idna
[i
].in
));
481 rc
= idna_to_ascii_8z (idna
[i
].in
, &out
,
482 IDNA_ALLOW_UNASSIGNED
|
483 IDNA_USE_STD3_ASCII_RULES
);
484 if (rc
!= IDNA_SUCCESS
&& strlen (idna
[i
].out
) > 0)
486 fail ("IDNA2 entry %d failed: %d\n", i
, rc
);
490 if (debug
&& rc
== IDNA_SUCCESS
)
492 printf ("computed out: %s\n", out
);
493 printf ("expected out: %s\n", idna
[i
].out
);
496 printf ("returned %d\n", rc
);
498 if (rc
== IDNA_SUCCESS
)
500 if (strlen (idna
[i
].out
) != strlen (out
) ||
501 strcasecmp (idna
[i
].out
, out
) != 0)
503 fail ("IDNA2 entry %d failed\n", i
);
513 else if (rc
!= IDNA_SUCCESS
&& strlen (idna
[i
].out
) == 0 && debug
)
514 printf ("OK (fail)\n");