2 <!DOCTYPE rfc SYSTEM "rfc2629.dtd">
6 <rfc category="info" ipr="full2026"
7 docName="draft-josefsson-idn-test-vectors">
11 <title>Nameprep and IDNA Test Vectors</title>
13 <author initials="S." surname="Josefsson" fullname="Simon Josefsson">
14 <organization></organization>
17 <street>Drottningholmsv. 70</street>
18 <city>Stockholm</city> <code>112 42</code>
19 <country>Sweden</country>
21 <email>simon@josefsson.org</email>
25 <date month="March" year="2003"/>
29 <t>This document contains test vectors for Nameprep and IDNA. The
30 majority of the test vectors are derived in order to cover various
31 corner cases in the specifications, but some anticipated typical data
32 from the real world are also included.</t>
40 <section title="Introduction">
42 <t>The Nameprep and IDNA specifications lack thorough examples that
43 would aid in implementing them. This document can act as a complement
44 to those specifications.</t>
46 <t>It should be pointed out that this document is not normative, and
47 thus any errors here should not be treated as gospel that defines
48 Nameprep or IDNA. When conforming to the specification and generating
49 output corresponding to values in this document is in conflict,
50 implementations should conform to the specification.</t>
54 <section title="Format of Nameprep Test Vectors">
56 <t>The tests follow a certain syntax, described here by showing one
57 complete example with comments intermixed. The comments are prefixed
58 with the '#' character.</t>
62 # First the (UTF-8) string is printed as a C octet string, with
63 # characters [A-Za-z .0-9] shown inline and other characters shown
64 # escaped with \xAB where AB is the hex sequence of that octet. The
65 # number of octets are also shown.
67 in: `foo\xC2\xADbar' (length 8)
69 # The input is also printed as Unicode codepoints.
71 input: U+0066 U+006F U+006F U+00AD U+0062 U+0061 U+0072
73 # After printing the input, the nameprep steps starts. When the
74 # string is modified, the specific operation that caused it is printed
75 # along with the new string of Unicode code points.
77 # 1) Map -- For each character in the input, check if it has a mapping
78 # and, if so, replace it with its mapping. This is described in
81 Table B.1 maps U+00AD to nothing.
82 U+0066 U+006f U+006f U+0062 U+0061 U+0072
84 # 2) Normalize -- Possibly normalize the result of step 1 using Unicode
85 # normalization. This is described in section 4.
87 # 3) Prohibit -- Check for any characters that are not allowed in the
88 # output. If any are found, return an error. This is described in
91 # 4) Check bidi -- Possibly check for right-to-left characters, and if
92 # any are found, make sure that the whole string satisfies the
93 # requirements for bidirectional strings. If the string does not
94 # satisfy the requirements for bidirectional strings, return an
95 # error. This is described in section 6.
97 # 1) The characters in section 5.8 MUST be prohibited.
99 # 2) If a string contains any RandALCat character, the string MUST NOT
100 # contain any LCat character.
102 # 3) If a string contains any RandALCat character, a RandALCat
103 # character MUST be the first character of the string, and a
104 # RandALCat character MUST be the last character of the string.
106 # The output is printed as Unicode codepoints.
108 output: U+0066 U+006f U+006f U+0062 U+0061 U+0072
110 # And finally the output is printed as UTF-8
112 out: `foobar' (length 6 bytes)
118 <section title="Nameprep Test Vectors">
120 <?rfc include="foo"?>
124 <section title="Security Considerations">
126 <t>The security considerations from Nameprep and IDNA are inherited,
127 see each respective document. These test vectors are not believed to
128 introduce new security considerations nor disrupt the operation of the
129 Internet, but may expose security weaknesses in existing
130 implementations. Any such incident should not be regarded as a
131 problem with this document, though, but rather taken as evidence that
132 this document served any purpose.</t>
141 <note title="Acknowledgments">
146 <section title="Nameprep test vectors in C syntax">
148 <t>In order to avoid having implementators type in the test vectors
149 above, a C structure with the data is provided.</t>
151 <t>The comment field is the section titles used in this document. The
152 in field contains UTF-8 encoded strings. The out field contains
153 expected output, or NULL if the expected result is an error. The
154 profile field can be ignored. The only significant setting for the
155 flags field is STRINGPREP_NO_UNASSIGNED which signals to the Nameprep
156 implementation that it should perform unassigned code point checking,
157 aka the "AllowUnassigned" flag. The rc field contains expected error
158 codes, where 0 indicates success and the other flags should be pretty
159 self explanatory.</t>
176 "foo\xC2\xAD\xCD\x8F\xE1\xA0\x86\xE1\xA0\x8B"
177 "bar""\xE2\x80\x8B\xE2\x81\xA0""baz\xEF\xB8\x80\xEF\xB8\x88"
178 "\xEF\xB8\x8F\xEF\xBB\xBF", "foobarbaz"
181 "Case folding ASCII U+0043 U+0041 U+0046 U+0045",
185 "Case folding 8bit U+00DF (german sharp s)",
189 "Case folding U+0130 (turkish capital I with dot)",
190 "\xC4\xB0", "i\xcc\x87"
193 "Case folding multibyte U+0143 U+037A",
194 "\xC5\x83\xCD\xBA", "\xC5\x84 \xCE\xB9"
197 "Case folding U+2121 U+33C6 U+1D7BB",
198 "\xE2\x84\xA1\xE3\x8F\x86\xF0\x9D\x9E\xBB",
199 "telc\xE2\x88\x95""kg\xCF\x83"
202 "Normalization of U+006a U+030c U+00A0 U+00AA",
203 "\x6A\xCC\x8C\xC2\xA0\xC2\xAA", "\xC7\xB0 a"
206 "Case folding U+1FB7 and normalization",
207 "\xE1\xBE\xB7", "\xE1\xBE\xB6\xCE\xB9"
210 "Self-reverting case folding U+01F0 and normalization",
211 "\xC7\xF0", "\xC7\xB0"
214 "Self-reverting case folding U+0390 and normalization",
215 "\xCE\x90", "\xCE\x90"
218 "Self-reverting case folding U+03B0 and normalization",
219 "\xCE\xB0", "\xCE\xB0"
222 "Self-reverting case folding U+1E96 and normalization",
223 "\xE1\xBA\x96", "\xE1\xBA\x96"
226 "Self-reverting case folding U+1F56 and normalization",
227 "\xE1\xBD\x96", "\xE1\xBD\x96"
230 "ASCII space character U+0020",
234 "Non-ASCII 8bit space character U+00A0",
238 "Non-ASCII multibyte space character U+1680",
239 "\xE1\x9A\x80", NULL, "Nameprep", 0,
240 STRINGPREP_CONTAINS_PROHIBITED
243 "Non-ASCII multibyte space character U+2000",
244 "\xE2\x80\x80", "\x20"
247 "Zero Width Space U+200b",
251 "Non-ASCII multibyte space character U+3000",
252 "\xE3\x80\x80", "\x20"
255 "ASCII control characters U+0010 U+007F",
256 "\x10\x7F", "\x10\x7F"
259 "Non-ASCII 8bit control character U+0085",
260 "\xC2\x85", NULL, "Nameprep", 0,
261 STRINGPREP_CONTAINS_PROHIBITED
264 "Non-ASCII multibyte control character U+180E",
265 "\xE1\xA0\x8E", NULL, "Nameprep", 0,
266 STRINGPREP_CONTAINS_PROHIBITED
269 "Zero Width No-Break Space U+FEFF",
273 "Non-ASCII control character U+1D175",
274 "\xF0\x9D\x85\xB5", NULL, "Nameprep", 0,
275 STRINGPREP_CONTAINS_PROHIBITED
278 "Plane 0 private use character U+F123",
279 "\xEF\x84\xA3", NULL, "Nameprep", 0,
280 STRINGPREP_CONTAINS_PROHIBITED
283 "Plane 15 private use character U+F1234",
284 "\xF3\xB1\x88\xB4", NULL, "Nameprep", 0,
285 STRINGPREP_CONTAINS_PROHIBITED
288 "Plane 16 private use character U+10F234",
289 "\xF4\x8F\x88\xB4", NULL, "Nameprep", 0,
290 STRINGPREP_CONTAINS_PROHIBITED
293 "Non-character code point U+8FFFE",
294 "\xF2\x8F\xBF\xBE", NULL, "Nameprep", 0,
295 STRINGPREP_CONTAINS_PROHIBITED
298 "Non-character code point U+10FFFF",
299 "\xF4\x8F\xBF\xBF", NULL, "Nameprep", 0,
300 STRINGPREP_CONTAINS_PROHIBITED
303 "Surrogate code U+DF42",
304 "\xED\xBD\x82", NULL, "Nameprep", 0,
305 STRINGPREP_CONTAINS_PROHIBITED
308 "Non-plain text character U+FFFD",
309 "\xEF\xBF\xBD", NULL, "Nameprep", 0,
310 STRINGPREP_CONTAINS_PROHIBITED
313 "Ideographic description character U+2FF5",
314 "\xE2\xBF\xB5", NULL, "Nameprep", 0,
315 STRINGPREP_CONTAINS_PROHIBITED
318 "Display property character U+0341",
319 "\xCD\x81", "\xCC\x81"
322 "Left-to-right mark U+200E",
323 "\xE2\x80\x8E", "\xCC\x81", "Nameprep", 0,
324 STRINGPREP_CONTAINS_PROHIBITED
328 "\xE2\x80\xAA", "\xCC\x81", "Nameprep", 0,
329 STRINGPREP_CONTAINS_PROHIBITED
332 "Language tagging character U+E0001",
333 "\xF3\xA0\x80\x81", "\xCC\x81", "Nameprep", 0,
334 STRINGPREP_CONTAINS_PROHIBITED
337 "Language tagging character U+E0042",
338 "\xF3\xA0\x81\x82", NULL, "Nameprep", 0,
339 STRINGPREP_CONTAINS_PROHIBITED
342 "Bidi: RandALCat character U+05BE and LCat characters",
343 "foo\xD6\xBE""bar", NULL, "Nameprep", 0,
344 STRINGPREP_BIDI_BOTH_L_AND_RAL
347 "Bidi: RandALCat character U+FD50 and LCat characters",
348 "foo\xEF\xB5\x90""bar", NULL, "Nameprep", 0,
349 STRINGPREP_BIDI_BOTH_L_AND_RAL
352 "Bidi: RandALCat character U+FB38 and LCat characters",
353 "foo\xEF\xB9\xB6""bar", "foo \xd9\x8e""bar"
355 { "Bidi: RandALCat without trailing RandALCat U+0627 U+0031",
356 "\xD8\xA7\x31", NULL, "Nameprep", 0,
357 STRINGPREP_BIDI_LEADTRAIL_NOT_RAL}
360 "Bidi: RandALCat character U+0627 U+0031 U+0628",
361 "\xD8\xA7\x31\xD8\xA8", "\xD8\xA7\x31\xD8\xA8"
364 "Unassigned code point U+E0002",
365 "\xF3\xA0\x80\x82", NULL, "Nameprep", STRINGPREP_NO_UNASSIGNED,
366 STRINGPREP_CONTAINS_UNASSIGNED
369 "Larger test (shrinking)",
370 "X\xC2\xAD\xC3\xDF\xC4\xB0\xE2\x84\xA1\x6a\xcc\x8c\xc2\xa0\xc2"
371 "\xaa\xce\xb0\xe2\x80\x80", "xssi\xcc\x87""tel\xc7\xb0 a\xce\xb0 ",
375 "Larger test (expanding)",
376 "X\xC3\xDF\xe3\x8c\x96\xC4\xB0\xE2\x84\xA1\xE2\x92\x9F\xE3\x8c\x80",
377 "xss\xe3\x82\xad\xe3\x83\xad\xe3\x83\xa1\xe3\x83\xbc\xe3\x83\x88"
378 "\xe3\x83\xab""i\xcc\x87""tel\x28""d\x29\xe3\x82\xa2\xe3\x83\x91"
379 "\xe3\x83\xbc\xe3\x83\x88"
387 <references title="Normative References">
388 <?rfc include="reference.RFC.3491.xml"?>
389 <?rfc include="reference.RFC.3490.xml"?>
393 <references title="Informative References">