]> git.saurik.com Git - apple/icu.git/blob - icuSources/test/testdata/conversion.txt
4e94f4713f91000846dbde47662e3882b0b09c6c
[apple/icu.git] / icuSources / test / testdata / conversion.txt
1 //*******************************************************************************
2 //
3 // Copyright (C) 2003-2006, International Business Machines
4 // Corporation and others. All Rights Reserved.
5 //
6 // file name: conversion.txt
7 // encoding: US-ASCII
8 // tab size: 8 (not used)
9 // indentation:4
10 //
11 // created on: 2003jul15
12 // created by: Markus W. Scherer
13 //
14 // ICU resource bundle source file with test data for data-driven conversion tests.
15 //
16 //*******************************************************************************
17
18 conversion:table(nofallback) {
19 Info {
20 Description { "Test data for conversion" }
21 LongDescription {
22 "Test data for data-driven conversion tests in icu/source/test/intltest/convtest.cpp\n"
23 "Run intltest conversion\n"
24
25 "Charset names starting with '*' are for testdata names.\n"
26
27 "ICU callbacks are specified as strings with pairs of characters, each optional.\n"
28 "Callback function - '?'=Sub '0'=Skip '.'=Stop '&'=Escape\n"
29 "Callback option - a letter is passed in directly as const char * see ucnv_err.h\n"
30 "Empty string: Sub callback with NULL option\n"
31
32 "In order to specify a charset substitution character (for ucnv_setSubstChars()),\n"
33 "add a NUL (U+0000) to the callback string followed by the subchar bytes as Latin-1\n"
34 "characters. For example, for a Sub callback with no option and a subchar of FC FC,\n"
35 "use the string \"?\x00\xFC\xFC\"\n"
36
37 "In order to specify a substitution string (for ucnv_setSubstString()),\n"
38 "add an '=' to the callback string followed by the substitution string.\n"
39 "For example, for a Sub callback with no option and a substitution string\n"
40 "of \"ab\", use the string \"?=ab\"\n"
41
42 "fallbacks: per-direction boolean, currently only for fromUnicode; see Jitterbug 2401\n"
43
44 "errorCode: (empty)==zero | invalid | illegal | truncated | illesc | unsuppesc\n"
45 }
46 }
47 TestData {
48 toUnicode {
49 Headers { "charset", "bytes", "unicode", "offsets", "flush", "fallbacks", "errorCode", "callback", "invalidChars" }
50 Cases {
51 // improve coverage of unrolled loops in ucnvmbcs.c/ucnv_MBCSSingleToBMPWithOffsets()
52 {
53 "ISO-8859-3",
54 :bin{ 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f2021222324252627 },
55 "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f !\x22#$%&'",
56 :intvector{ 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39 },
57 :int{1}, :int{0}, "", "?", :bin{""}
58 }
59 // test that ISO-2022-JP encodes ASCII as itself
60 {
61 "ISO-2022-JP",
62 :bin{ 3f4041424344454647 },
63 "?@ABCDEFG",
64 :intvector{ 0,1,2,3,4,5,6,7,8 },
65 :int{1}, :int{1}, "", "?", :bin{""}
66 }
67 // test that ISO-2022-CN encodes ASCII as itself
68 {
69 "ISO-2022-CN",
70 :bin{ 3f4041424344454647 },
71 "?@ABCDEFG",
72 :intvector{ 0,1,2,3,4,5,6,7,8 },
73 :int{1}, :int{1}, "", "?", :bin{""}
74 }
75
76 // ISO-2022-KR
77
78 // truncated, partial escape sequence
79 {
80 "ibm-25546",
81 :bin{ 1b }, "", :intvector{},
82 :int{1}, :int{1}, "truncated", ".", :bin{ 1b }
83 }
84 {
85 "ibm-25546",
86 :bin{ 1b24 }, "", :intvector{},
87 :int{1}, :int{1}, "truncated", ".", :bin{ 1b24 }
88 }
89 {
90 "ibm-25546",
91 :bin{ 1b2429 }, "", :intvector{},
92 :int{1}, :int{1}, "truncated", ".", :bin{ 1b2429 }
93 }
94 // complete escape sequence but nothing else
95 {
96 "ibm-25546",
97 :bin{ 1b242943 }, "", :intvector{},
98 :int{1}, :int{1}, "", ".", :bin{""}
99 }
100 {
101 "ibm-25546",
102 :bin{ 1b2429430e }, "", :intvector{},
103 :int{1}, :int{1}, "", ".", :bin{""}
104 }
105 // escape plus ASCII character
106 {
107 "ibm-25546",
108 :bin{ 1b24294341 }, "A", :intvector{ 4 },
109 :int{1}, :int{1}, "", ".", :bin{""}
110 }
111 // escape plus incomplete DBCS character
112 {
113 "ibm-25546",
114 :bin{ 1b2429430e41 }, "", :intvector{},
115 :int{1}, :int{1}, "truncated", ".", :bin{ 41 }
116 }
117 // all complete with DBCS character
118 {
119 "ibm-25546",
120 :bin{ 1b2429430e4141 }, "\uc88b", :intvector{ 5 },
121 :int{1}, :int{1}, "", ".", :bin{""}
122 }
123 // more complicated example
124 {
125 "ibm-25546",
126 :bin{ 411b242943420e4141affe0f43 },
127 "AB\uc88b%XAF%XFEC",
128 :intvector{ 0, 5, 7, 9, 9, 9, 9, 9, 9, 9, 9, 12 },
129 :int{1}, :int{1}, "", "&", :bin{""}
130 }
131
132 // truncated, partial escape sequence
133 {
134 "ISO-2022-KR",
135 :bin{ 1b }, "", :intvector{},
136 :int{1}, :int{1}, "truncated", ".", :bin{ 1b }
137 }
138 {
139 "ISO-2022-KR",
140 :bin{ 1b24 }, "", :intvector{},
141 :int{1}, :int{1}, "truncated", ".", :bin{ 1b24 }
142 }
143 {
144 "ISO-2022-KR",
145 :bin{ 1b2429 }, "", :intvector{},
146 :int{1}, :int{1}, "truncated", ".", :bin{ 1b2429 }
147 }
148 // complete escape sequence but nothing else
149 {
150 "ISO-2022-KR",
151 :bin{ 1b242943 }, "", :intvector{},
152 :int{1}, :int{1}, "", ".", :bin{""}
153 }
154 {
155 "ISO-2022-KR",
156 :bin{ 1b2429430e }, "", :intvector{},
157 :int{1}, :int{1}, "", ".", :bin{""}
158 }
159 // escape plus ASCII character
160 {
161 "ISO-2022-KR",
162 :bin{ 1b24294341 }, "A", :intvector{ 4 },
163 :int{1}, :int{1}, "", ".", :bin{""}
164 }
165 // escape plus incomplete DBCS character
166 {
167 "ISO-2022-KR",
168 :bin{ 1b2429430e41 }, "", :intvector{},
169 :int{1}, :int{1}, "truncated", ".", :bin{ 41 }
170 }
171 // all complete with DBCS character
172 {
173 "ISO-2022-KR",
174 :bin{ 1b2429430e4141 }, "\uc88b", :intvector{ 5 },
175 :int{1}, :int{1}, "", ".", :bin{""}
176 }
177 // more complicated example
178 {
179 "ISO-2022-KR",
180 :bin{ 411b242943420e4141affe0f43 },
181 "AB\uc88b%XAF%XFEC",
182 :intvector{ 0, 5, 7, 9, 9, 9, 9, 9, 9, 9, 9, 12 },
183 :int{1}, :int{1}, "", "&", :bin{""}
184 }
185
186 // ISO-2022-JP
187
188 // truncated, partial escape sequence
189 {
190 "ISO-2022-JP",
191 :bin{ 1b }, "", :intvector{},
192 :int{1}, :int{1}, "truncated", ".", :bin{ 1b }
193 }
194 {
195 "ISO-2022-JP-2",
196 :bin{ 1b24 }, "", :intvector{},
197 :int{1}, :int{1}, "truncated", ".", :bin{ 1b24 }
198 }
199 // complete escape sequence but nothing else
200 {
201 "ISO-2022-JP-2",
202 :bin{ 1b2442 }, "", :intvector{},
203 :int{1}, :int{1}, "", ".", :bin{""}
204 }
205 // escape plus incomplete DBCS character
206 {
207 "ISO-2022-JP-2",
208 :bin{ 1b244241 }, "", :intvector{},
209 :int{1}, :int{1}, "truncated", ".", :bin{ 41 }
210 }
211 // all complete with DBCS character
212 {
213 "ISO-2022-JP-2",
214 :bin{ 1b24424141 }, "\u758f", :intvector{ 3 },
215 :int{1}, :int{1}, "", ".", :bin{""}
216 }
217 // test the G2 designator & SS2 shift
218 {
219 "ISO-2022-JP-2",
220 :bin{ 431b2e46461b244241411b4e4e353f }, "CF\u758f\u039e\u7591", :intvector{ 0, 4, 8, 12, 13 },
221 :int{1}, :int{1}, "", ".", :bin{""}
222 }
223 // JIS7 with Katakana
224 {
225 "JIS7",
226 :bin{ 41420e41420f4142 }, "AB\uff81\uff82AB", :intvector{ 0, 1, 3, 4, 6, 7 },
227 :int{1}, :int{1}, "", ".", :bin{""}
228 }
229 // JIS8 with Katakana
230 {
231 "JIS8",
232 :bin{ 41c15c1b284a5cc242 }, "A\uff81\\\xa5\uff82B", :intvector{ 0, 1, 2, 6, 7, 8 },
233 :int{1}, :int{1}, "", ".", :bin{""}
234 }
235
236 // ISO-2022-CN
237
238 // truncated, partial escape sequence
239 {
240 "ISO_2022,locale=zh,version=1",
241 :bin{ 1b }, "", :intvector{},
242 :int{1}, :int{1}, "truncated", ".", :bin{ 1b }
243 }
244 {
245 "ISO_2022,locale=zh,version=1",
246 :bin{ 1b24 }, "", :intvector{},
247 :int{1}, :int{1}, "truncated", ".", :bin{ 1b24 }
248 }
249 {
250 "ISO_2022,locale=zh,version=1",
251 :bin{ 1b2429 }, "", :intvector{},
252 :int{1}, :int{1}, "truncated", ".", :bin{ 1b2429 }
253 }
254 // complete escape sequence but nothing else
255 {
256 "ISO_2022,locale=zh,version=1",
257 :bin{ 1b242941 }, "", :intvector{},
258 :int{1}, :int{1}, "", ".", :bin{""}
259 }
260 {
261 "ISO_2022,locale=zh,version=1",
262 :bin{ 1b2429410e }, "", :intvector{},
263 :int{1}, :int{1}, "", ".", :bin{""}
264 }
265 // escape plus ASCII character
266 {
267 "ISO_2022,locale=zh,version=1",
268 :bin{ 1b24294141 }, "\x41", :intvector{ 4 },
269 :int{1}, :int{1}, "", ".", :bin{""}
270 }
271 // escape plus incomplete DBCS character
272 {
273 "ISO_2022,locale=zh,version=1",
274 :bin{ 1b2429410e41 }, "", :intvector{},
275 :int{1}, :int{1}, "truncated", ".", :bin{ 41 }
276 }
277 // all complete with DBCS character
278 {
279 "ISO_2022,locale=zh,version=1",
280 :bin{ 1b2429410e4141 }, "\u4eae", :intvector{ 5 },
281 :int{1}, :int{1}, "", ".", :bin{""}
282 }
283 // ISO-2022-CN-EXT with all subcharsets and shifts and with supplementary code points
284 {
285 "ISO-2022-CN-EXT",
286 :bin{ 1b2429411b242a480e41411b2429457e7c1b4e70341b242b4d1b2429477c341b4f664c2421 },
287 "\u4eae\u9f82\u56cd\u56cc\U0002a6d6\x30",
288 :intvector{ 9, 15, 19, 29, 33, 33, 35 },
289 :int{1}, :int{1}, "", ".", :bin{""}
290 }
291
292 // illegal and unsupported escape sequences
293 // SS2 without designator: illegal
294 {
295 "ISO-2022-CN-EXT",
296 :bin{ 411b4e2121 }, "\x41", :intvector{ 0 },
297 :int{1}, :int{1}, "illesc", ".", :bin{ 1b4e }
298 }
299 // G3 designator: recognized, but not supported for -CN (only for -CN-EXT)
300 {
301 "ISO-2022-CN",
302 :bin{ 411b242b491b4f2121 }, "\x41", :intvector{ 0 },
303 :int{1}, :int{1}, "unsuppesc", ".", :bin{ 1b242b49 }
304 }
305
306 // ISO-2022 SBCS
307 // [U_ENABLE_GENERIC_ISO_2022]
308 // The _generic_ ISO-2022 converter is disabled starting 2003-dec-03 (ICU 2.8).
309 // For details see the icu mailing list from 2003-dec-01 and the ucnv2022.c file.
310 // Language-specific variants of ISO-2022 continue to be available as listed below.
311 //{
312 // "ISO_2022",
313 // :bin{ 0008090a0d1a1c1f203f415c7d7e7f },
314 // "\x00\x08\t\n\r\x1a\x1c\x1f ?A\\}~\x7f",
315 // :intvector{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 },
316 // :int{1}, :int{1}, "", ".", :bin{""}
317 //}
318
319 // DBCS-only extensions
320 {
321 "ibm-970",
322 :bin{ 617eece9b2eb },
323 "\x61\x7e\u4e00\ub000",
324 :intvector{ 0, 1, 2, 4 },
325 :int{1}, :int{1}, "", "?", :bin{""}
326 }
327
328 {
329 "ibm-971",
330 :bin{ 617eece9b2eb },
331 "\ufffd\u4e00\ub000",
332 :intvector{ 0, 2, 4 },
333 :int{1}, :int{1}, "", "?", :bin{""}
334 }
335
336 {
337 "ibm-16684",
338 :bin{ 430e4395ecc1404042e1 },
339 "\ufffd\u30C8\u30C8\u309A\u3000\u20ac",
340 :intvector{ 0, 2, 4, 4, 6, 8 },
341 :int{1}, :int{0}, "", "?", :bin{""}
342 }
343
344 {
345 "ibm-1399",
346 :bin{ 430e4395ecc140400fe1 },
347 "\uff62\u30C8\u30C8\u309A\u3000\u20ac",
348 :intvector{ 0, 2, 4, 4, 6, 9 },
349 :int{1}, :int{0}, "", "?", :bin{""}
350 }
351
352 // extensions
353 {
354 "ibm-1390",
355 :bin{ 430e4395ecc1 },
356 "\uff63\u30C8\u30C8\u309A",
357 :intvector{ 0, 2, 4, 4 },
358 :int{1}, :int{0}, "", "?", :bin{""}
359 }
360
361 {
362 "ibm-16684",
363 :bin{ ececec8bec8cec8d4386ecb5ecb6ecb7 },
364 "\ufffd\u31f6\u31f7\u31f8\u30ab\u304b\u309a\u304d\u309a\u304f\u309a",
365 :intvector{ 0, 2, 4, 6, 8, 10, 10, 12, 12, 14, 14 },
366 :int{1}, :int{0}, "", "?", :bin{""}
367 }
368
369 {
370 "ibm-1390",
371 :bin{ 43860eececec8bec8cec8d4386ecb5ecb6ecb7ecc10fec },
372 "\uff63\uff76\ufffd\u31f6\u31f7\u31f8\u30ab\u304b\u309a\u304d\u309a\u304f\u309a\u30C8\u309A\x1a",
373 :intvector{ 0, 1, 3, 5, 7, 9, 11, 13, 13, 15, 15, 17, 17, 19, 19, 22 },
374 :int{1}, :int{0}, "", "?", :bin{""}
375 }
376
377 {
378 "*test3",
379 :bin{ 00050601020b0701020a01020c },
380 "\u20ac\x05\x06\x0b\U00101234\U00023456\ufffd",
381 :intvector{ 0, 1, 2, 3, 6, 6, 7, 7, 10 },
382 :int{1}, :int{0}, "", "?", :bin{""}
383 }
384
385 // normal conversions
386 {
387 "UTF-16LE",
388 :bin{ 310000d801dc00d902dc320000d8330001dc3400 },
389 "1\U00010001\U000500022\ufffd3\ufffd4",
390 :intvector{ 0, 2, 2, 6, 6, 10, 12, 14, 16, 18 },
391 :int{1}, :int{0}, "", "?", :bin{""}
392 }
393 { "UTF-16LE", :bin{ 00 }, "", :intvector{}, :int{1}, :int{0}, "truncated", ".", :bin{ 00 } }
394 { "UTF-16LE", :bin{ 00d800 }, "", :intvector{}, :int{1}, :int{0}, "truncated", ".", :bin{ 00d800 } }
395
396 {
397 "UTF-16BE",
398 :bin{ 0031d800dc01d900dc020032d8000033dc010034 },
399 "1\U00010001\U000500022\ufffd3\ufffd4",
400 :intvector{ 0, 2, 2, 6, 6, 10, 12, 14, 16, 18 },
401 :int{1}, :int{0}, "", "?", :bin{""}
402 }
403 { "UTF-16BE", :bin{ 00 }, "", :intvector{}, :int{1}, :int{0}, "truncated", ".", :bin{ 00 } }
404 { "UTF-16BE", :bin{ d800dc }, "", :intvector{}, :int{1}, :int{0}, "truncated", ".", :bin{ d800dc } }
405
406 // e4b8 is a partial sequence
407 { "UTF-8", :bin{ 31e4ba8ce4b8 }, "1\u4e8c", :intvector{ 0, 1 }, :int{1}, :int{0}, "truncated", ".", :bin{ e4b8 } }
408 { "UTF-8", :bin{ 31e4ba8ce4b8 }, "1\u4e8c\ufffd", :intvector{ 0, 1, 4 }, :int{1}, :int{0}, "", "?", :bin{""} }
409
410 // LMBCS with escape callback (1292a0 is unassigned)
411 {
412 "LMBCS",
413 :bin{ 12c9501292a01292a1 },
414 "\u4e2e%X12%X92%XA0\ue5c4",
415 :intvector{ 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 6 },
416 :int{1}, :int{0}, "", "&", :bin{""}
417 }
418
419 // IMAP-mailbox-name with SUB
420 // a<DEL> a&AB~ a&AB\x0c a&AB- a&AB. a&.
421 {
422 "IMAP-mailbox-name",
423 :bin{ 617f612641427e612641420c612641422d612641422e61262e },
424 "a\ufffda\ufffda\ufffda\ufffda\ufffda\ufffd",
425 :intvector{ 0, 1, 2, 4, 7, 9, 12, 14, 17, 19, 22, 23 },
426 :int{1}, :int{0}, "", "?", :bin{""}
427 }
428
429 // using testdata_test1.cnv
430 { "*test1", :bin{ 000506070809 }, "\u20ac\x05\x06\U00101234\ufffd\ufffd", :intvector{ 0, 1, 2, 3, 3, 4, 5 }, :int{1}, :int{0}, "", "", :bin{""} }
431
432 // surrogates in CESU-8
433 { "CESU-8", :bin{ eda080eda081edb081 }, "\ud800\U00010401", :intvector{ 0, 3, 6 }, :int{1}, :int{0}, "", "", :bin{""} }
434 // e080 is a partial sequence
435 { "UTF-8", :bin{ 31ffe4ba8ce08061 }, "1\ufffd\u4e8c\ufffda", :intvector{ 0, 1, 2, 5, 7 }, :int{0}, :int{0}, "", "", :bin{ e080 } }
436 // fbbfbfbfbf exceedes U+10ffff
437 { "UTF-8", :bin{ 31fbbfbfbfbf61 }, "1\ufffda", :intvector{ 0, 1, 6 }, :int{0}, :int{0}, "", "", :bin{ fbbfbfbfbf } }
438
439 // lead byte a2 without trail byte
440 { "ibm-1363", :bin{ a2aea2 }, "\u00a1", :intvector{ 0 }, :int{1}, :int{0}, "truncated", ".", :bin{ a2 } }
441 { "ibm-1363", :bin{ a2aea2 }, "\u00a1\u001a", :intvector{ 0, 2 }, :int{1}, :int{0}, "", "?", :bin{""} }
442
443 // simple sample, no error handling
444 { "UTF-8", :bin{ 61F48FBFBF }, "a\U0010FFFF", :intvector{ 0, 1, 1 }, :int{1}, :int{0}, "", "", :bin{""} }
445 }
446 }
447
448 // --------------------------------------------------------------------- ***
449
450 fromUnicode {
451 Headers { "charset", "unicode", "bytes", "offsets", "flush", "fallbacks", "errorCode", "callback", "invalidUChars" }
452 Cases {
453 {
454 "SCSU",
455 "1\U00010001\u0085\U000500022\ud8003\udc014\ue001",
456 :bin{ 310be0008102050fd900dc02e7320efffd330efffd34186881 },
457 :intvector{ 0,1,1,1,1,3,3,4,4,4,4,4,6,6,7,7,7,8,9,9,9,10,11,11,11 },
458 :int{1}, :int{0}, "", "?", ""
459 }
460 // Test substitution strings.
461 {
462 "windows-1252", // stateless MBCS with WriteSub(), should internally set char *
463 "a\ufdd0c",
464 :bin{ 61402421402463 },
465 :intvector{ 0,1,1,1,1,1,2 },
466 :int{1}, :int{0}, "", "?=@$!@$", ""
467 }
468 {
469 "ibm-930", // stateful MBCS
470 "a\ufdd0\u4e00\ufdd0e",
471 :bin{ 620e4bce0f400e45414bce0f4066 },
472 :intvector{ 0,1,1,1,1,1,2,2,2,3,3,3,3,4 },
473 :int{1}, :int{0}, "", "?=\u4e01 ", ""
474 }
475 {
476 "iso-2022-jp",
477 "a\x1bc", // Unicode ESC must not occur as a character
478 :bin{ 6163 },
479 :intvector{ 0,2 },
480 :int{1}, :int{0}, "", "?=", "" // empty substitution string
481 }
482 {
483 "iso-2022-cn",
484 "a\x1bc", // Unicode ESC must not occur as a character
485 :bin{ 61202063 },
486 :intvector{ 0,1,1,2 },
487 :int{1}, :int{0}, "", "?= ", ""
488 }
489 {
490 "iso-2022-cn",
491 "a\x1bc", // Unicode ESC must not occur as a character
492 :bin{ 611b2429410e523b0f2063 },
493 :intvector{ 0,1,1,1,1,1,1,1,1,1,2 },
494 :int{1}, :int{0}, "", "?=\u4e00 ", ""
495 }
496 {
497 "us-ascii",
498 "a\x85c",
499 :bin{ 61402421402463 },
500 :intvector{ 0,1,1,1,1,1,2 },
501 :int{1}, :int{0}, "", "?=@$!@$", ""
502 }
503 // ISO 2022-CN: test a single-byte subchar, j5171
504 {
505 "iso-2022-cn",
506 "a\x1bc", // Unicode ESC must not occur as a character
507 :bin{ 612163 },
508 :intvector{ 0,1,2 },
509 :int{1}, :int{0}, "", "?\x00\x21", ""
510 }
511 // UTF-16/32: do not output a BOM if there is no data at all
512 {
513 "UTF-16",
514 "",
515 :bin{ "" },
516 :intvector{ },
517 :int{1}, :int{1}, "", "?", ""
518 }
519 {
520 "UTF-32",
521 "",
522 :bin{ "" },
523 :intvector{ },
524 :int{1}, :int{1}, "", "?", ""
525 }
526
527 // do not convert SO/SI/ESC
528 {
529 "iso-2022-jp",
530 "A\x0eB\x0f\x09\x1bC",
531 :bin{ 411a421a091a43 },
532 :intvector{ 0,1,2,3,4,5,6 },
533 :int{1}, :int{1}, "", "?", ""
534 }
535 {
536 "iso-2022-cn",
537 "A\x0eB\x0f\x09\x1bC",
538 :bin{ 411a421a091a43 },
539 :intvector{ 0,1,2,3,4,5,6 },
540 :int{1}, :int{1}, "", "?", ""
541 }
542 {
543 "iso-2022-kr",
544 "A\x0eB\x0f\x09\x1bC",
545 :bin{ 1b242943411a421a091a43 },
546 :intvector{ -1,-1,-1,-1,0,1,2,3,4,5,6 },
547 :int{1}, :int{1}, "", "?", ""
548 }
549 {
550 "ibm-25546",
551 "A\x0eB\x0f\x09\x1bC",
552 :bin{ 1b242943411a421a091a43 },
553 :intvector{ -1,-1,-1,-1,0,1,2,3,4,5,6 },
554 :int{1}, :int{1}, "", "?", ""
555 }
556
557 // test ISO 8859-1/7 vs. JIS X 0201
558 {
559 "ISO-2022-JP-2",
560 "?@A\u00e4\u03b1\u203EB",
561 :bin{ 3f40411B2E411B4E641B2E461B4E611B284A7E421B2842 },
562 :intvector{ 0,1,2,3,3,3,3,3,3,4,4,4,4,4,4,5,5,5,5,6,6,6,6 },
563 :int{1}, :int{1}, "", "?", ""
564 }
565
566 // Improve ucnv_ext.c code coverage:
567 // There will be a partial match up to the lead surrogate of U+603ff
568 // which then results in one more unit in the prefetch buffer
569 // than the match length when converting one code unit at a time.
570 // See ucnv_extContinueMatchFromU() comment
571 // "the match did not use all of preFromU[] - keep the rest for replay"
572 {
573 "*test3",
574 "\U00101234\U00101234\U00050005\U000603ff",
575 :bin{ 07070001020e05ff },
576 :intvector{ 0, 2, 2, 2, 2, 2, 2, 6 },
577 :int{1}, :int{0}, "", "?", ""
578 }
579
580 // test that ISO-2022-JP encodes ASCII as itself
581 {
582 "ISO-2022-JP",
583 "?@ABCDEFG",
584 :bin{ 3f4041424344454647 },
585 :intvector{ 0,1,2,3,4,5,6,7,8 },
586 :int{1}, :int{1}, "", "?", ""
587 }
588 // test that ISO-2022-CN encodes ASCII as itself
589 {
590 "ISO-2022-CN",
591 "?@ABCDEFG",
592 :bin{ 3f4041424344454647 },
593 :intvector{ 0,1,2,3,4,5,6,7,8 },
594 :int{1}, :int{1}, "", "?", ""
595 }
596
597 // moved from cintltst /tsconv/nccbtst/TestSkipCallBack
598 {
599 "iso-2022-jp",
600 "\u3000\xe9\u3001",
601 :bin{ 1b2442212121221b2842 },
602 :intvector{ 0,0,0,0,0,2,2,2,2,2 },
603 :int{1}, :int{1}, "", "0", ""
604 }
605 // moved from cintltst /tsconv/nccbtst/TestSubCallBack
606 {
607 "iso-2022-jp",
608 "A\xe9B\xe9\u3000",
609 :bin{ 411a421a1b244221211b2842 },
610 :intvector{ 0,1,2,3,4,4,4,4,4,4,4,4 },
611 :int{1}, :int{1}, "", "?", ""
612 }
613 // moved from cintltst /tsconv/nccbtst/TestSubWithValueCallBack
614 {
615 "iso-2022-jp",
616 "A\xe9B\xe9\u3000",
617 :bin{ 41255530304539422555303045391b244221211b2842 },
618 :intvector{ 0,1,1,1,1,1,1,2,3,3,3,3,3,3,4,4,4,4,4,4,4,4 },
619 :int{1}, :int{1}, "", "&", ""
620 }
621 {
622 "iso-2022-cn",
623 "\u4e00\u3712\u4e01",
624 :bin{ 1b2429410e523b0f2555333731320e36210f },
625 :intvector{ 0,0,0,0,0,0,0,1,1,1,1,1,1,1,2,2,2,2 },
626 :int{1}, :int{1}, "", "&", ""
627 }
628 {
629 "iso-2022-cn",
630 "A\u3712\u4e00",
631 :bin{ 412555333731321b2429410e523b0f },
632 :intvector{ 0,1,1,1,1,1,1,2,2,2,2,2,2,2,2 },
633 :int{1}, :int{1}, "", "&", ""
634 }
635 {
636 "iso-2022-cn",
637 "\u3000\u3712\u3001",
638 :bin{ 1b2429410e21210f2555333731320e21220f },
639 :intvector{ 0,0,0,0,0,0,0,1,1,1,1,1,1,1,2,2,2,2 },
640 :int{1}, :int{1}, "", "&", ""
641 }
642
643 // moved from cintltst /tsconv/nucnvtst/TestJIS
644 {
645 "JIS",
646 "\uFF81\uFF82\u30EC\u30ED\u30EE\u30EF\uFF93\uFF94\uFF95\uFF96\uFF97\uFF98",
647 :bin{ 1b244225412544256c256d256e256F25622564256625682569256a1b2842 },
648 :intvector{ 0,0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,11,11,11 },
649 :int{1}, :int{1}, "", "?", ""
650 }
651 {
652 "JIS7",
653 "\uFF81\uFF82\u30EC\u30ED\u30EE\u30EF\uFF93\uFF94\uFF95\uFF96\uFF97\uFF98",
654 :bin{ 0e41420f1b2442256c256d256e256F0e5354555657580f1b2842 },
655 :intvector{ 0,0,1,2,2,2,2,2,2,3,3,4,4,5,5,6,6,7,8,9,10,11,11,11,11,11 },
656 :int{1}, :int{1}, "", "?", ""
657 }
658 {
659 "JIS8",
660 "\uFF81\uFF82\u30EC\u30ED\u30EE\u30EF\uFF93\uFF94\uFF95\uFF96\uFF97\uFF98",
661 :bin{ C1C21b2442256c256d256e256F1b284AD3D4D5D6D7D81b2842 },
662 :intvector{ 0,1,2,2,2,2,2,3,3,4,4,5,5,6,6,6,6,7,8,9,10,11,11,11,11 },
663 :int{1}, :int{1}, "", "?", ""
664 }
665
666 // moved from cintltst /tsconv/ncnvtst/TestErrorBehaviour
667 {
668 "iso-2022-jp",
669 "\u3000\x50\udc01\u3001",
670 :bin{ 1B244221211B2842501A1B24422122 },
671 :intvector{ 0,0,0,0,0,1,1,1,1,2,3,3,3,3,3 },
672 :int{0}, :int{1}, "", "?", "\udc01"
673 }
674 {
675 "iso-2022-jp",
676 "\u3000\x50\udc01\u3001",
677 :bin{ 1B244221211B2842501A1B244221221b2842 },
678 :intvector{ 0,0,0,0,0,1,1,1,1,2,3,3,3,3,3,3,3,3 },
679 :int{1}, :int{1}, "", "?", ""
680 }
681 {
682 "iso-2022-kr",
683 "\x61\u4e00\udc01\u4e00",
684 :bin{ 1b242943610e6c690f1a0e6c69 },
685 :intvector{ -1,-1,-1,-1,0,1,1,1,2,2,3,3,3 },
686 :int{0}, :int{1}, "", "?", "\udc01"
687 }
688 {
689 "iso-2022-kr",
690 "\x61\u4e00\udc01\u4e00",
691 :bin{ 1b242943610e6c690f1a0e6c690f },
692 :intvector{ -1,-1,-1,-1,0,1,1,1,2,2,3,3,3,3 },
693 :int{1}, :int{1}, "", "?", ""
694 }
695
696 // ISO-2022-KR
697 {
698 "ibm-25546",
699 "AB\uc88b\U00050005\uacccC",
700 :bin{ 1b24294341420e41410f7b552b35303030357d0e306a0f43 },
701 :intvector{ -1,-1,-1,-1,0,1,2,2,2,3,3,3,3,3,3,3,3,3,3,5,5,5,6,6 },
702 :int{1}, :int{1}, "", "&U", ""
703 }
704 {
705 "ibm-25546",
706 "AB\uc88b\U00050005\uacccC",
707 :bin{ 1b24294341420e41410f1a0e306a0f43 },
708 :intvector{ -1,-1,-1,-1,0,1,2,2,2,3,3,5,5,5,6,6 },
709 :int{1}, :int{1}, "", "?\x00\x1a", ""
710 }
711 {
712 "ibm-25546",
713 "AB\uc88b\U00050005\uacccC",
714 :bin{ 1b24294341420e41412f7e306a0f43 },
715 :intvector{ -1,-1,-1,-1,0,1,2,2,2,3,3,5,5,6,6 },
716 :int{1}, :int{1}, "", "?", ""
717 }
718 {
719 "ibm-25546",
720 "AB\uc88b\U00050005\uaccc",
721 :bin{ 1b24294341420e41412f7e306a0f },
722 :intvector{ -1,-1,-1,-1,0,1,2,2,2,3,3,5,5,5 },
723 :int{1}, :int{1}, "", "?", ""
724 }
725 {
726 "ISO-2022-KR",
727 "AB\uc88b\U00050005\uacccC",
728 :bin{ 1b24294341420e41410f7b552b35303030357d0e306a0f43 },
729 :intvector{ -1,-1,-1,-1,0,1,2,2,2,3,3,3,3,3,3,3,3,3,3,5,5,5,6,6 },
730 :int{1}, :int{1}, "", "&U", ""
731 }
732 {
733 "ISO-2022-KR",
734 "AB\uc88b\U00050005\uacccC",
735 :bin{ 1b24294341420e41410f1a0e306a0f43 },
736 :intvector{ -1,-1,-1,-1,0,1,2,2,2,3,3,5,5,5,6,6 },
737 :int{1}, :int{1}, "", "?", ""
738 }
739 {
740 "ISO-2022-KR",
741 "AB\uc88b\U00050005\uacccC",
742 :bin{ 1b24294341420e41412f7e306a0f43 },
743 :intvector{ -1,-1,-1,-1,0,1,2,2,2,3,3,5,5,6,6 },
744 :int{1}, :int{1}, "", "?\x00\x2f\x7e", ""
745 }
746 {
747 "ISO-2022-KR",
748 "AB\uc88b\U00050005\uaccc",
749 :bin{ 1b24294341420e41412f7e306a0f },
750 :intvector{ -1,-1,-1,-1,0,1,2,2,2,3,3,5,5,5 },
751 :int{1}, :int{1}, "", "?\x00\x2f\x7e", ""
752 }
753
754 // ISO-2022-JP-2 with G2 designator & SS2 shift
755 {
756 "ISO-2022-JP-2",
757 "CF\u758f\u038f\u7591",
758 :bin{ 43461b244241411b2e461b4e3f353f1b2842 },
759 :intvector{ 0,1,2,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4 },
760 :int{1}, :int{1}, "", ".", ""
761 }
762 // JIS7 with Katakana
763 {
764 "JIS7",
765 "AB\uff81\uff82AB",
766 :bin{ 41420e41420f4142 },
767 :intvector{ 0,1,2,2,3,4,4,5 },
768 :int{1}, :int{1}, "", ".", ""
769 }
770 // JIS7 with shift to ASCII at the very end
771 {
772 "JIS7",
773 "AB\uff81\uff82",
774 :bin{ 41420e41420f },
775 :intvector{ 0,1,2,2,3,3 },
776 :int{1}, :int{1}, "", ".", ""
777 }
778 // JIS8 with Katakana
779 {
780 "JIS8",
781 "A\uff81\\\xa5\uff82B",
782 :bin{ 41c15c1b284a5cc2421b2842 },
783 :intvector{ 0,1,2,3,3,3,3,4,5,5,5,5 },
784 :int{1}, :int{1}, "", ".", ""
785 }
786
787 // ISO-2022-CN-EXT with all subcharsets and shifts and with supplementary code points
788 {
789 "ISO-2022-CN-EXT",
790 "\u4eae\u9f82\u56cd\u56cc\U0002a6d6\x30",
791 :bin{ 1b2429410e41411b2429457e7c1b242a481b4e70341b2429477c341b242b4d1b4f664c0f30 },
792 :intvector{ 0,0,0,0,0,0,0,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4,4,4,4,6,6 },
793 :int{1}, :int{1}, "", ".", ""
794 }
795 // ISO-2022-CN-EXT with shift to ASCII at the very end
796 {
797 "ISO-2022-CN-EXT",
798 "\u4eae\u9f82\u56cd\u56cc\U0002a6d6",
799 :bin{ 1b2429410e41411b2429457e7c1b242a481b4e70341b2429477c341b242b4d1b4f664c0f },
800 :intvector{ 0,0,0,0,0,0,0,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4 },
801 :int{1}, :int{1}, "", ".", ""
802 }
803 // ISO-2022-CN-EXT without flush so do not shift to ASCII at the very end
804 {
805 "ISO-2022-CN-EXT",
806 "\u4eae\u9f82\u56cd\u56cc\U0002a6d6",
807 :bin{ 1b2429410e41411b2429457e7c1b242a481b4e70341b2429477c341b242b4d1b4f664c },
808 :intvector{ 0,0,0,0,0,0,0,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4,4,4,4 },
809 :int{0}, :int{1}, "", ".", ""
810 }
811
812 // windows-936 vs. ibm-1386
813 {
814 "ibm-1386",
815 "\x1a\u20ac\u5555\x80\x81\U00055555",
816 :bin{ 7fa2e3dffb7f7fa1a1 },
817 :intvector{ 0, 1, 1, 2, 2, 3, 4, 5, 5 },
818 :int{1}, :int{1}, "", "?", ""
819 }
820 {
821 "windows-936",
822 "\x1a\u20ac\u5555\x80\x81\U00055555",
823 :bin{ 1a80dffb3f3f3f },
824 :intvector{ 0, 1, 2, 2, 3, 4, 5 },
825 :int{1}, :int{1}, "", "?", ""
826 }
827
828 // verify that if a conversion table does not have any mapping for U+0000,
829 // then there will not even be a phantom fallback to 00
830 {
831 "ibm-971",
832 "\x00",
833 :bin{ affe },
834 :intvector{ 0, 0 },
835 :int{1}, :int{1}, "", "?", ""
836 }
837
838 {
839 "*test4",
840 "\x00",
841 :bin{ ff },
842 :intvector{ 0 },
843 :int{1}, :int{1}, "", "?", ""
844 }
845
846 // extension in testdata
847 {
848 "*test4x",
849 "\u20ac\x09",
850 :bin{ 0009 },
851 :intvector{ 0, 1 },
852 :int{1}, :int{1}, "", "?", ""
853 }
854
855 // DBCS-only extensions
856 {
857 "ibm-970",
858 "\x61\uffa1\u2015\ub000",
859 :bin{ 611aa1aab2eb },
860 :intvector{ 0, 1, 2, 2, 3, 3 },
861 :int{1}, :int{1}, "", "?", ""
862 }
863
864 {
865 "ibm-971",
866 "\x61\uffa1\u2015\ub000",
867 :bin{ affeaffeaffeb2eb },
868 :intvector{ 0, 0, 1, 1, 2, 2, 3, 3 },
869 :int{1}, :int{1}, "", "?", ""
870 }
871
872 {
873 "ibm-1390,swaplfnl",
874 "\uff63\u30C8\u30C8\u309A\u3000\x41\u20ac\x0a",
875 :bin{ 430e4395ecc140400fc1e115 },
876 :intvector{ 0, 1, 1, 1, 2, 2, 4, 4, 5, 5, 6, 7 },
877 :int{1}, :int{0}, "", "?", ""
878 }
879
880 {
881 "ibm-16684",
882 "\uff63\u30C8\u30C8\u309A\u3000\x41\u20ac\x0a",
883 :bin{ fefe4395ecc14040fefe42e1fefe },
884 :intvector{ 0, 0, 1, 1, 2, 2, 4, 4, 5, 5, 6, 6, 7, 7 },
885 :int{1}, :int{0}, "", "?", ""
886 }
887
888 {
889 "ibm-1399",
890 "\uff63\u30C8\u30C8\u309A\u3000\x41\u20ac\x0a",
891 :bin{ 440e4395ecc140400fc1e125 },
892 :intvector{ 0, 1, 1, 1, 2, 2, 4, 4, 5, 5, 6, 7 },
893 :int{1}, :int{0}, "", "?", ""
894 }
895
896 // <subchar1> from |2 mappings
897 {
898 "ibm-1390",
899 "\x0e\x0f\u0901\U00050000\uffe8\uffee",
900 :bin{ 3f3f0efefefefe0f3f3f },
901 :intvector{ 0, 1, 2, 2, 2, 3, 3, 5, 5, 6 },
902 :int{1}, :int{1}, "", "?", ""
903 }
904
905 // <subchar1> from |2 mappings, and also contains a fallback to 00
906 {
907 "*test4",
908 "\u20ac\u20ad\U00050005\U00023456\U0010ffff\x30",
909 :bin{ 0000e10102030affff },
910 :intvector{ 0, 1, 2, 4, 4, 4, 4, 6, 8 },
911 :int{1}, :int{1}, "", "?", ""
912 }
913
914 // setting a <subchar> resets the <subchar1>
915 {
916 "*test4",
917 "\u20ac\u20ad\U00050005\U00023456\U0010ffff\x30",
918 :bin{ 00000102030f0102030a0102030f0102030f },
919 :intvector{ 0, 1, 2, 2, 2, 2, 4, 4, 4, 4, 6, 6, 6, 6, 8, 8, 8, 8 },
920 :int{1}, :int{1}, "", "?\x00\x01\x02\x03\x0f", ""
921 }
922
923 // fallback to 00 with old single-byte data structure
924 {
925 "*test1",
926 "\u20ac\u20ad\U00101234\U00050000",
927 :bin{ 000007ff },
928 :intvector{ 0, 1, 2, 4 },
929 :int{1}, :int{1}, "", "?", ""
930 }
931
932 // extensions
933 {
934 "ibm-1390",
935 "\u025a\u025a\u0300\u025a\u0301\u025a\u0302\uffe8\U0002a0f9",
936 :bin{ 0ed896eccaeccbd896ea530f3f0eb7c20f },
937 :intvector{ 0, 0, 0, 1, 1, 3, 3, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8 },
938 :int{1}, :int{0}, "", "?", ""
939 }
940
941 {
942 "*test3",
943 "\xc4\xc4\xc4\U00101234\xc4\xc4\U00101234\x05",
944 :bin{ ffffff070501020c },
945 :intvector{ 0, 1, 2, 3, 5, 5, 5, 5 },
946 :int{1}, :int{0}, "", "?", ""
947 }
948
949 {
950 "*test3",
951 "\U00101234\U00101234\U00050005\U00101234\U00050005\U00060006",
952 :bin{ 07070001020e05070001020f09 },
953 :intvector{ 0, 2, 2, 2, 2, 2, 2, 6, 6, 6, 6, 6, 6 },
954 :int{1}, :int{0}, "", "?", ""
955 }
956
957 // normal conversions
958 {
959 "UTF-16LE",
960 "1\U00010001\U000500022\ud8003\udc014",
961 :bin{ 310000d801dc00d902dc3200fdff3300fdff3400 },
962 :intvector{ 0, 0, 1, 1, 1, 1, 3, 3, 3, 3, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9 },
963 :int{1}, :int{0}, "", "?", ""
964 }
965 { "UTF-16LE", "\ud800", :bin{""}, :intvector{}, :int{1}, :int{0}, "truncated", ".", "\ud800" }
966
967 {
968 "UTF-16BE",
969 "1\U00010001\U000500022\ud8003\udc014",
970 :bin{ 0031d800dc01d900dc020032fffd0033fffd0034 },
971 :intvector{ 0, 0, 1, 1, 1, 1, 3, 3, 3, 3, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9 },
972 :int{1}, :int{0}, "", "?", ""
973 }
974 { "UTF-16BE", "\ud800", :bin{""}, :intvector{}, :int{1}, :int{0}, "truncated", ".", "\ud800" }
975
976 {
977 "SCSU",
978 "1\U00010001\u00082\ud8003\udc014\ue001",
979 :bin{ 310be000810108320efffd330efffd34186881 },
980 :intvector{ 0, 1, 1, 1, 1, 3, 3, 4, 5, 5, 5, 6, 7, 7, 7, 8, 9, 9, 9 },
981 :int{1}, :int{0}, "", "?", ""
982 }
983
984 // escape callback
985 {
986 "ISCII",
987 "A\u0901\U00023456\u0902B\U00023456C",
988 :bin{ 41ef42a1255544383444255544433536a24225554438344425554443353643 },
989 :intvector{
990 0,
991 1,1,1,
992 2,2,2,2,2,2,
993 2,2,2,2,2,2,
994 4,
995 5,
996 6,6,6,6,6,6,
997 6,6,6,6,6,6,
998 8
999 },
1000 :int{1}, :int{0}, "", "&", ""
1001 }
1002
1003 // escape callback (hex)
1004 {
1005 "iso-2022-jp",
1006 "\u3000\U00023456\u3001\U00023456B\u901c",
1007 :bin{ 1b244221211b284226237832333435363b1b244221221b284226237832333435363b42262378393031433b },
1008 :intvector{
1009 0,0,0,0,0,
1010 1,1,1,1,1,1,1,1,1,1,1,1,
1011 3,3,3,3,3,
1012 4,4,4,4,4,4,4,4,4,4,4,4,
1013 6,
1014 7,7,7,7,7,7,7,7
1015 },
1016 :int{1}, :int{0}, "", "&X", ""
1017 }
1018
1019 // sub callback
1020 {
1021 "gb18030",
1022 "$\x7f\x80\u01f9\u20ac\u4e00\u9fa6\uffff\U00010000\U0010ffff",
1023 :bin{ 247f81308130a8bfa2e3d2bb82358f338431a43990308130e3329a35 },
1024 :intvector{ 0, 1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 10, 10, 10, 10 },
1025 :int{1}, :int{0}, "", "?", ""
1026 }
1027
1028 // skip callback
1029 { "ibm-930", "\u6D63\u6D64\u6D65\u6D66", :bin{ 0e5d5f5d63466b0f }, :intvector{ 0, 0, 0, 1, 1, 3, 3, 3 }, :int{1}, :int{0}, "", "0", "" }
1030 { "ibm-930", "\u6D63\u6D64\ud89a\u6D66", :bin{ 0e5d5f5d63466b0f }, :intvector{ 0, 0, 0, 1, 1, 3, 3, 3 }, :int{1}, :int{0}, "", "0", "" }
1031 { "ibm-930", "\u6D63\u6D64\ud89a\u6D66", :bin{ 0e5d5f5d63 }, :intvector{ 0, 0, 0, 1, 1 }, :int{1}, :int{0}, "illegal", "0i", "\ud89a" }
1032
1033 // sub callback for supplementary code point
1034 { "LATIN1", "1\U000104012", :bin{ 311a32 }, :intvector{ 0, 1, 3 }, :int{1}, :int{0}, "", "", "" }
1035 { "ibm-920", "1\U000104012", :bin{ 311a32 }, :intvector{ 0, 1, 3 }, :int{1}, :int{0}, "", "", "" }
1036
1037 // sub callback with AA as subchar
1038 { "ibm-920", "1\U000104012", :bin{ 31AA32 }, :intvector{ 0, 1, 3 }, :int{1}, :int{0}, "", "?\x00\xAA", "" }
1039
1040 // same but not flushing
1041 { "LATIN1", "1\U000104012", :bin{ 311a32 }, :intvector{ 0, 1, 3 }, :int{0}, :int{0}, "", "", "\U00010401" }
1042 { "ibm-920", "1\U000104012", :bin{ 311a32 }, :intvector{ 0, 1, 3 }, :int{0}, :int{0}, "", "", "\U00010401" }
1043
1044 // simple sample, no error handling
1045 { "UTF-8", "a\U0010FFFF", :bin{ 61F48FBFBF }, :intvector{ 0, 1, 1, 1, 1 }, :int{1}, :int{0}, "", "", "" }
1046 }
1047 }
1048
1049 getUnicodeSet {
1050 // charset - will be opened, and ucnv_getUnicodeSet() called on it
1051 // map - set of code points and strings that must be in the returned set
1052 // mapnot - set of code points and strings that must *not* be in the returned set
1053 // which - numeric UConverterUnicodeSet value
1054 Headers { "charset", "map", "mapnot", "which" }
1055 Cases {
1056 // Unicode charsets that do not map surrogate code points
1057 {
1058 "UTF-8",
1059 "[\x00-\ud7ff\ue000-\U0010ffff]",
1060 "[\ud800-\udfff]",
1061 :int{0}
1062 }
1063 {
1064 "UTF-16",
1065 "[\x00-\ud7ff\ue000-\U0010ffff]",
1066 "[\ud800-\udfff]",
1067 :int{0}
1068 }
1069 {
1070 "UTF-16BE",
1071 "[\x00-\ud7ff\ue000-\U0010ffff]",
1072 "[\ud800-\udfff]",
1073 :int{0}
1074 }
1075 {
1076 "UTF-16LE",
1077 "[\x00-\ud7ff\ue000-\U0010ffff]",
1078 "[\ud800-\udfff]",
1079 :int{0}
1080 }
1081 {
1082 "UTF-32",
1083 "[\x00-\ud7ff\ue000-\U0010ffff]",
1084 "[\ud800-\udfff]",
1085 :int{0}
1086 }
1087 {
1088 "UTF-32BE",
1089 "[\x00-\ud7ff\ue000-\U0010ffff]",
1090 "[\ud800-\udfff]",
1091 :int{0}
1092 }
1093 {
1094 "UTF-32LE",
1095 "[\x00-\ud7ff\ue000-\U0010ffff]",
1096 "[\ud800-\udfff]",
1097 :int{0}
1098 }
1099
1100 // Unicode charsets that do map surrogate code points
1101 {
1102 "UTF-7",
1103 "[\x00-\U0010ffff]",
1104 "[]",
1105 :int{0}
1106 }
1107 {
1108 "SCSU",
1109 "[\x00-\U0010ffff]",
1110 "[]",
1111 :int{0}
1112 }
1113 {
1114 "BOCU-1",
1115 "[\x00-\U0010ffff]",
1116 "[]",
1117 :int{0}
1118 }
1119 {
1120 "CESU-8",
1121 "[\x00-\U0010ffff]",
1122 "[]",
1123 :int{0}
1124 }
1125
1126 // versions of ISO-2022-KR
1127 {
1128 "ISO-2022-KR",
1129 "[\x00-\x0d\x10-\x1a\x1c-\x7f\xa1\xa4\xfe\u0111\u4e00\u4e01\uac00-\uac02\uffe6]",
1130 "[\x0e\x0f\x1b\x80-\xa0\xa3\xa5\xff-\u0110\uac03\uffe7-\U0010ffff]",
1131 :int{0}
1132 }
1133 {
1134 "ibm-25546",
1135 "[\x00-\x0d\x10-\x1a\x1c-\x7f\xa1\xa4\xfe\u0111\u4e00\u4e01\uac00-\uac01\uffe6]",
1136 "[\x0e\x0f\x1b\x80-\xa0\xa3\xa5\xff-\u0110\uac02\uffe7-\U0010ffff]",
1137 :int{0}
1138 }
1139
1140 // versions of ISO-2022-JP
1141 {
1142 "ISO-2022-JP",
1143 "[\x00-\x0d\x10-\x1a\x1c-\x7f\u0391-\u03a1\uff61-\uff9f\u4e00\u4e01\uffe5]",
1144 "[\x0e\x0f\x1b\u0100-\u0113\u0385-\u038a\u4e02\u4e27-\u4e29\uffe6-\U0010ffff]",
1145 :int{0}
1146 }
1147 {
1148 "ISO-2022-JP-2",
1149 "[\x00-\x0d\x10-\x1a\x1c-\u0113\u0385-\u038a\u0390-\u03a1\uff61-\uff9f\u4e00-\u4e05\uffe6]",
1150 "[\x0e\x0f\x1b\uffe7-\U0010ffff]",
1151 :int{0}
1152 }
1153
1154 // versions of ISO-2022-CN
1155 {
1156 "ISO-2022-CN",
1157 "[\x00-\x0d\x10-\x1a\x1c-\x7f\u4e00\u4e01\u9f98\ufe6b]",
1158 "[\x0e\x0f\x1b\u4e29\uffe6-\U0010ffff]",
1159 :int{0}
1160 }
1161 {
1162 "ISO-2022-CN-EXT",
1163 "[\x00-\x0d\x10-\x1a\x1c-\x7f\u4e00-\u4e05\u9f98\ufe6b\u4e28-\u4e2b\U00020000\U00020003-\U00020005\U00029664]",
1164 "[\x0e\x0f\x1b\U00020001\U00020002\U0002a6d7-\U0010ffff]",
1165 :int{0}
1166 }
1167
1168 // DBCS-only
1169 {
1170 "ibm-971",
1171 "[\xa1\xa4\uac01\ub000]",
1172 "[\x00-\x9f\u2015]",
1173 :int{0}
1174 }
1175
1176 {
1177 "ibm-16684",
1178 "[\xa0\xa1\xa4\xa6-\xab\xad-\u017f\u0254\u309b-\u30ff\u4e00-\u4e05\U00023d00\U000243bc\U0002a6b2"
1179 "{\u0254\u0300}{\u0254\u0301}{\u304b\u309a}{\u30ad\u309a}{\u30af\u309a}]",
1180 "[\x00-0x9f\xa2\xa3\xa5\xac\u0200-\u024f\U00010000-\U0001ffff\U0002a61b-\U0002a6b1]",
1181 :int{0}
1182 }
1183
1184 // extensions
1185 {
1186 "ibm-1390",
1187 "[\x00-\x0d\x10-\u017f\u0254\u309b-\u30ff\u4e00-\u4e05\U00023d00\U000243bc\U0002a6b2"
1188 "{\u0254\u0300}{\u0254\u0301}{\u304b\u309a}{\u30ad\u309a}{\u30af\u309a}]",
1189 "[\x0e\x0f\u0200-\u024f\U00010000-\U0001ffff\U0002a61b-\U0002a6b1]",
1190 :int{0}
1191 }
1192
1193 {
1194 "*test3",
1195 "[\x05\x0b\xc0\u20ac\U00023456\U00101234"
1196 "{\U00101234\U00050005\U00060006}{\U00101234\U00050005}{\U00101234\U00060006}{\xc4\xc4\U00101234\x05}]",
1197 "[\x06\x0e\U00034567\U000febcd{\U00101234\U00070007}]",
1198 :int{0}
1199 }
1200 }
1201 }
1202 }
1203 }