]> git.saurik.com Git - apple/icu.git/blame - icuSources/test/testdata/conversion.txt
ICU-400.37.tar.gz
[apple/icu.git] / icuSources / test / testdata / conversion.txt
CommitLineData
374ca955
A
1//*******************************************************************************
2//
46f4442e 3// Copyright (C) 2003-2008, International Business Machines
374ca955
A
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
73c04bcf 18conversion:table(nofallback) {
374ca955
A
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
73c04bcf 32 "In order to specify a charset substitution character (for ucnv_setSubstChars()),\n"
374ca955
A
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
73c04bcf
A
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
374ca955
A
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 {
fd0068a8
A
51 // Test ticket 5691: consistent illegal sequences
52 // The following test cases are for illegal character byte sequences.
53 //
54 // Unfortunately, we cannot use the Shift-JIS examples from the ticket
55 // comments because our Shift-JIS table is Windows-compatible and
56 // therefore has no illegal single bytes. Same for GBK.
57 // Instead, we use the stricter GB 18030 also for 2-byte examples.
58 // The byte sequences are generally slightly different from the ticket
59 // comment, simply using assigned characters rather than just
60 // theoretically valid sequences.
61 {
62 "gb18030",
63 :bin{ 618140813c81ff7a },
64 "a\u4e02\\x81<\\x81\\xFFz",
65 :intvector{ 0,1,3,3,3,3,4,5,5,5,5,5,5,5,5,7 },
66 :int{1}, :int{0}, "", "&C", :bin{""}
67 }
68 {
69 "EUC-JP",
70 :bin{ 618fb0a98fb03c8f3cb0a97a },
71 "a\u4e28\\x8F\\xB0<\\x8F<\u9022z",
72 :intvector{ 0,1,4,4,4,4,5,5,5,5,6,7,7,7,7,8,9,11 },
73 :int{1}, :int{0}, "", "&C", :bin{""}
74 }
75 {
76 "gb18030",
77 :bin{ 618130fc318130fc8181303c3e813cfc817a },
78 "a\u05ed\\x810\u9f07\\x810<>\\x81<\u9f07z",
79 :intvector{ 0,1,5,5,5,5,6,7,9,9,9,9,10,11,12,13,13,13,13,14,15,17 },
80 :int{1}, :int{0}, "", "&C", :bin{""}
81 }
82 {
83 "UTF-8",
84 :bin{ 61f1808182f180813cf18081fff180ff3cf1ff3c3e7a },
85 "a\U00040042\\xF1\\x80\\x81<\\xF1\\x80\\x81\\xFF\\xF1\\x80\\xFF<\\xF1\\xFF<>z",
86 :intvector{ 0,1,1,5,5,5,5,5,5,5,5,5,5,5,5,8,9,9,9,9,9,9,9,9,9,9,9,9,12,12,12,12,13,13,13,13,13,13,13,13,15,15,15,15,16,17,17,17,17,18,18,18,18,19,20,21 },
87 :int{1}, :int{0}, "", "&C", :bin{""}
88 }
89 {
90 "ISO-2022-JP",
91 :bin{ 1b24424141af4142affe41431b2842 },
92 "\u758f\\xAF\u758e\\xAF\\xFE\u790e",
93 :intvector{ 3,5,5,5,5,6,8,8,8,8,8,8,8,8,10 },
94 :int{1}, :int{0}, "", "&C", :bin{""}
95 }
96 {
97 "ibm-25546",
98 :bin{ 411b242943420e4141af4142affe41430f5a },
99 "AB\uc88b\\xAF\uc88c\\xAF\\xFE\uc88dZ",
100 :intvector{ 0,5,7,9,9,9,9,10,12,12,12,12,12,12,12,12,14,17 },
101 :int{1}, :int{0}, "", "&C", :bin{""}
102 }
103 {
104 "ISO-2022-KR",
105 :bin{ 411b242943420e4141af4142affe41430f5a },
106 "AB\uc88b\\xAF\uc88c\\xAF\\xFE\uc88dZ",
107 :intvector{ 0,5,7,9,9,9,9,10,12,12,12,12,12,12,12,12,14,17 },
108 :int{1}, :int{0}, "", "&C", :bin{""}
109 }
110 {
111 "ISO-2022-CN",
112 :bin{ 411b242941420e4141af4142affe41430f5a },
113 "AB\u4eae\\xAF\u8c05\\xAF\\xFE\u64a9Z",
114 :intvector{ 0,5,7,9,9,9,9,10,12,12,12,12,12,12,12,12,14,17 },
115 :int{1}, :int{0}, "", "&C", :bin{""}
116 }
117 {
118 "HZ",
119 :bin{ 417e7b4141af4142affe41437e7d5a },
120 "A\u4eae\\xAF\u8c05\\xAF\\xFE\u64a9Z",
121 :intvector{ 0,3,5,5,5,5,6,8,8,8,8,8,8,8,8,10,14 },
122 :int{1}, :int{0}, "", "&C", :bin{""}
123 }
124 // Test ticket 5691: consistent illegal sequences
125 // The following test cases are for illegal escape/designator/shift sequences.
126 //
127 // ISO-2022-JP and -CN with illegal escape sequences.
128 {
129 "ISO-2022-JP",
130 :bin{ 611b24201b244241411b283f1b28427a },
131 "a\\x1B$ \u758f\\x1B\u2538z",
132 :intvector{ 0,1,1,1,1,2,3,7,9,9,9,9,10,15 },
133 :int{1}, :int{0}, "", "&C", :bin{""}
134 }
135 {
136 "ISO-2022-CN",
137 :bin{ 611b2429201b2429410e41410f7a },
138 "a\\x1B$) \u4eaez",
139 :intvector{ 0,1,1,1,1,2,3,4,10,13 },
140 :int{1}, :int{0}, "", "&C", :bin{""}
141 }
142 // Test ticket 5691: ISO-2022-JP-2 with illegal single-shift SS2 and SS3 sequences.
143 // The first ESC N comes before its designator sequence, the last sequence is ESC+space.
144 {
145 "ISO-2022-JP-2",
146 :bin{ 4e1b4e4e1b2e414e1b4e4e4e1b204e },
147 "N\\x1BNNN\xceN\\x1B N",
148 :intvector{ 0,1,1,1,1,2,3,7,10,11,12,12,12,12,13,14 },
149 :int{1}, :int{0}, "", "&C", :bin{""}
150 }
151 {
152 "ISO-2022-CN-EXT",
153 :bin{ 4e1b4e4e1b242a484e1b4e4e4e4e1b204e },
154 "N\\x1BNNN\u8f0eN\\x1B N",
155 :intvector{ 0,1,1,1,1,2,3,8,11,13,14,14,14,14,15,16 },
156 :int{1}, :int{0}, "", "&C", :bin{""}
157 }
158 {
159 "ISO-2022-CN-EXT",
160 :bin{ 4f1b4f4f1b242b494f1b4f4f4f4f1b204f },
161 "O\\x1BOOO\u492bO\\x1B O",
162 :intvector{ 0,1,1,1,1,2,3,8,11,13,14,14,14,14,15,16 },
163 :int{1}, :int{0}, "", "&C", :bin{""}
164 }
165 // Test ticket 5691: HZ with illegal tilde sequences.
166 {
167 "HZ",
168 :bin{ 417e20427e21437e80447e7b41417e207e41427e7f41437e7d5a },
169 "A\\x7E B\\x7E!C\\x7E\\x80D\u4eae\\x7E\\x20\\x7E\u8c05\\x7E\\x7F\u64a9Z",
170 :intvector{ 0,1,1,1,1,2,3,4,4,4,4,5,6,7,7,7,7,7,7,7,7,9, // SBCS
171 12,14,14,14,14,14,14,14,14,16,16,16,16,17,19,19,19,19,19,19,19,19,21, // DBCS
172 25 }, // SBCS
173 :int{1}, :int{0}, "", "&C", :bin{""}
174 }
175 // Test ticket 5691: Example from Peter Edberg.
176 {
177 "ISO-2022-JP",
178 :bin{ 1b244230212f7e742630801b284a621b2458631b2842648061 },
179 "\u4e9c\ufffd\u7199\ufffdb\ufffd$Xcd\ufffda",
180 :intvector{ 3,5,7,9,14,15,16,17,18,22,23,24 },
181 :int{1}, :int{0}, "", "?", :bin{""}
182 }
46f4442e
A
183 // Test bug 6071 (2:1 Unicode:charset SBCS mapping).
184 {
185 "*test1bmp",
186 :bin{ 050008 },
187 "e@uv",
188 :intvector{ 0,1,2,2 },
189 :int{1}, :int{1}, "", "?", :bin{""}
190 }
fd0068a8
A
191 // test that HZ limits its byte values to lead bytes 21..7d and trail bytes 21..7e
192 {
193 "HZ",
194 :bin{ 7e7b21212120217e217f772100007e217e7e7d207e7e807e0a2b },
195 "\u3000\ufffd\u3013\ufffd\u9ccc\ufffd\ufffd\u3013 ~\ufffd+",
196 :intvector{ 2,4,6,8,10,12,14,15,19,20,22,25 },
197 :int{1}, :int{1}, "", "?", :bin{""}
198 }
199 // improve coverage of ISO-2022-JP converter with hardcoded JIS X 0201 and
200 // using the Shift-JIS table for JIS X 0208 (ticket #5797)
201 {
202 "ISO-2022-JP",
203 :bin{ 1b284a7d7e801b2442306c20217f7e21202160217f22202225227f5f211b2842 },
204 "}\u203e\ufffd\u4e00\ufffd\ufffd\ufffd\ufffd\xf7\ufffd\ufffd\u25b2\ufffd\u6f3e",
205 :intvector{ 3,4,5,9,11,12,14,16,17,19,21,23,25,27 },
206 :int{1}, :int{1}, "", "?", :bin{""}
207 }
46f4442e
A
208 // improve coverage of ISO-2022-JP converter by simulating erroneous input
209 {
210 "ISO-2022-JP-2",
211 :bin{ 0f0ed11b2e41461b244141411b4e411b2e4147451b4ed31b2e4641411b4ed2 },
212 "\u0046\u4eae\u00c1\u6865\u4eae",
213 :intvector{ 6, 10, 14, 18, 26 },
214 :int{1}, :int{0}, "", "0", :bin{""}
215 }
216 // improve coverage of JIS7 converter by simulating incomplete shifted input
217 {
218 "JIS7",
219 :bin{ 0e11 },
220 "",
221 :intvector{},
222 :int{1}, :int{0}, "", "0", :bin{""}
223 }
374ca955
A
224 // improve coverage of unrolled loops in ucnvmbcs.c/ucnv_MBCSSingleToBMPWithOffsets()
225 {
226 "ISO-8859-3",
227 :bin{ 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f2021222324252627 },
228 "\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#$%&'",
229 :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 },
230 :int{1}, :int{0}, "", "?", :bin{""}
231 }
232 // test that ISO-2022-JP encodes ASCII as itself
233 {
234 "ISO-2022-JP",
235 :bin{ 3f4041424344454647 },
236 "?@ABCDEFG",
237 :intvector{ 0,1,2,3,4,5,6,7,8 },
238 :int{1}, :int{1}, "", "?", :bin{""}
239 }
240 // test that ISO-2022-CN encodes ASCII as itself
241 {
242 "ISO-2022-CN",
243 :bin{ 3f4041424344454647 },
244 "?@ABCDEFG",
245 :intvector{ 0,1,2,3,4,5,6,7,8 },
246 :int{1}, :int{1}, "", "?", :bin{""}
247 }
248
249 // ISO-2022-KR
250
251 // truncated, partial escape sequence
252 {
253 "ibm-25546",
254 :bin{ 1b }, "", :intvector{},
255 :int{1}, :int{1}, "truncated", ".", :bin{ 1b }
256 }
257 {
258 "ibm-25546",
259 :bin{ 1b24 }, "", :intvector{},
260 :int{1}, :int{1}, "truncated", ".", :bin{ 1b24 }
261 }
262 {
263 "ibm-25546",
264 :bin{ 1b2429 }, "", :intvector{},
265 :int{1}, :int{1}, "truncated", ".", :bin{ 1b2429 }
266 }
267 // complete escape sequence but nothing else
268 {
269 "ibm-25546",
270 :bin{ 1b242943 }, "", :intvector{},
271 :int{1}, :int{1}, "", ".", :bin{""}
272 }
273 {
274 "ibm-25546",
275 :bin{ 1b2429430e }, "", :intvector{},
276 :int{1}, :int{1}, "", ".", :bin{""}
277 }
278 // escape plus ASCII character
279 {
280 "ibm-25546",
281 :bin{ 1b24294341 }, "A", :intvector{ 4 },
282 :int{1}, :int{1}, "", ".", :bin{""}
283 }
284 // escape plus incomplete DBCS character
285 {
286 "ibm-25546",
287 :bin{ 1b2429430e41 }, "", :intvector{},
288 :int{1}, :int{1}, "truncated", ".", :bin{ 41 }
289 }
290 // all complete with DBCS character
291 {
292 "ibm-25546",
293 :bin{ 1b2429430e4141 }, "\uc88b", :intvector{ 5 },
294 :int{1}, :int{1}, "", ".", :bin{""}
295 }
296 // more complicated example
297 {
298 "ibm-25546",
299 :bin{ 411b242943420e4141affe0f43 },
300 "AB\uc88b%XAF%XFEC",
301 :intvector{ 0, 5, 7, 9, 9, 9, 9, 9, 9, 9, 9, 12 },
302 :int{1}, :int{1}, "", "&", :bin{""}
303 }
304
305 // truncated, partial escape sequence
306 {
307 "ISO-2022-KR",
308 :bin{ 1b }, "", :intvector{},
309 :int{1}, :int{1}, "truncated", ".", :bin{ 1b }
310 }
311 {
312 "ISO-2022-KR",
313 :bin{ 1b24 }, "", :intvector{},
314 :int{1}, :int{1}, "truncated", ".", :bin{ 1b24 }
315 }
316 {
317 "ISO-2022-KR",
318 :bin{ 1b2429 }, "", :intvector{},
319 :int{1}, :int{1}, "truncated", ".", :bin{ 1b2429 }
320 }
321 // complete escape sequence but nothing else
322 {
323 "ISO-2022-KR",
324 :bin{ 1b242943 }, "", :intvector{},
325 :int{1}, :int{1}, "", ".", :bin{""}
326 }
327 {
328 "ISO-2022-KR",
329 :bin{ 1b2429430e }, "", :intvector{},
330 :int{1}, :int{1}, "", ".", :bin{""}
331 }
332 // escape plus ASCII character
333 {
334 "ISO-2022-KR",
335 :bin{ 1b24294341 }, "A", :intvector{ 4 },
336 :int{1}, :int{1}, "", ".", :bin{""}
337 }
338 // escape plus incomplete DBCS character
339 {
340 "ISO-2022-KR",
341 :bin{ 1b2429430e41 }, "", :intvector{},
342 :int{1}, :int{1}, "truncated", ".", :bin{ 41 }
343 }
344 // all complete with DBCS character
345 {
346 "ISO-2022-KR",
347 :bin{ 1b2429430e4141 }, "\uc88b", :intvector{ 5 },
348 :int{1}, :int{1}, "", ".", :bin{""}
349 }
350 // more complicated example
351 {
352 "ISO-2022-KR",
353 :bin{ 411b242943420e4141affe0f43 },
354 "AB\uc88b%XAF%XFEC",
355 :intvector{ 0, 5, 7, 9, 9, 9, 9, 9, 9, 9, 9, 12 },
356 :int{1}, :int{1}, "", "&", :bin{""}
357 }
d5d484b0
A
358 // empty segment (using substitution and stop)
359 {
360 "ISO-2022-KR",
361 :bin{ 1b242943610e0f620d0a },
362 "a\uFFFDb\u000D\u000A",
363 :intvector{ 4, 6, 7, 8, 9 },
364 :int{1}, :int{1}, "", "?", :bin{""}
365 }
366 {
367 "ISO-2022-KR",
368 :bin{ 1b242943610e0f620d0a },
369 "a",
370 :intvector{ 4 },
371 :int{1}, :int{1}, "illesc", ".", :bin{"0f"}
372 }
374ca955
A
373
374 // ISO-2022-JP
375
376 // truncated, partial escape sequence
377 {
378 "ISO-2022-JP",
379 :bin{ 1b }, "", :intvector{},
380 :int{1}, :int{1}, "truncated", ".", :bin{ 1b }
381 }
382 {
383 "ISO-2022-JP-2",
384 :bin{ 1b24 }, "", :intvector{},
385 :int{1}, :int{1}, "truncated", ".", :bin{ 1b24 }
386 }
387 // complete escape sequence but nothing else
388 {
389 "ISO-2022-JP-2",
390 :bin{ 1b2442 }, "", :intvector{},
391 :int{1}, :int{1}, "", ".", :bin{""}
392 }
393 // escape plus incomplete DBCS character
394 {
395 "ISO-2022-JP-2",
396 :bin{ 1b244241 }, "", :intvector{},
397 :int{1}, :int{1}, "truncated", ".", :bin{ 41 }
398 }
399 // all complete with DBCS character
400 {
401 "ISO-2022-JP-2",
402 :bin{ 1b24424141 }, "\u758f", :intvector{ 3 },
403 :int{1}, :int{1}, "", ".", :bin{""}
404 }
405 // test the G2 designator & SS2 shift
406 {
407 "ISO-2022-JP-2",
408 :bin{ 431b2e46461b244241411b4e4e353f }, "CF\u758f\u039e\u7591", :intvector{ 0, 4, 8, 12, 13 },
409 :int{1}, :int{1}, "", ".", :bin{""}
410 }
411 // JIS7 with Katakana
412 {
413 "JIS7",
414 :bin{ 41420e41420f4142 }, "AB\uff81\uff82AB", :intvector{ 0, 1, 3, 4, 6, 7 },
415 :int{1}, :int{1}, "", ".", :bin{""}
416 }
417 // JIS8 with Katakana
418 {
419 "JIS8",
420 :bin{ 41c15c1b284a5cc242 }, "A\uff81\\\xa5\uff82B", :intvector{ 0, 1, 2, 6, 7, 8 },
421 :int{1}, :int{1}, "", ".", :bin{""}
422 }
d5d484b0
A
423 // empty segment (using substitution and stop)
424 {
425 "ISO-2022-JP",
426 :bin{ 61621b24421b284263640d0a },
427 "ab\uFFFDcd\u000D\u000A",
428 :intvector{ 0, 1, 5, 8, 9, 10, 11 },
429 :int{1}, :int{1}, "", "?", :bin{""}
430 }
431 {
432 "ISO-2022-JP",
433 :bin{ 61621b24421b284263640d0a },
434 "ab",
435 :intvector{ 0, 1 },
436 :int{1}, :int{1}, "illesc", ".", :bin{"1b2842"}
437 }
374ca955
A
438
439 // ISO-2022-CN
440
441 // truncated, partial escape sequence
442 {
443 "ISO_2022,locale=zh,version=1",
444 :bin{ 1b }, "", :intvector{},
445 :int{1}, :int{1}, "truncated", ".", :bin{ 1b }
446 }
447 {
448 "ISO_2022,locale=zh,version=1",
449 :bin{ 1b24 }, "", :intvector{},
450 :int{1}, :int{1}, "truncated", ".", :bin{ 1b24 }
451 }
452 {
453 "ISO_2022,locale=zh,version=1",
454 :bin{ 1b2429 }, "", :intvector{},
455 :int{1}, :int{1}, "truncated", ".", :bin{ 1b2429 }
456 }
457 // complete escape sequence but nothing else
458 {
459 "ISO_2022,locale=zh,version=1",
460 :bin{ 1b242941 }, "", :intvector{},
461 :int{1}, :int{1}, "", ".", :bin{""}
462 }
463 {
464 "ISO_2022,locale=zh,version=1",
465 :bin{ 1b2429410e }, "", :intvector{},
466 :int{1}, :int{1}, "", ".", :bin{""}
467 }
468 // escape plus ASCII character
469 {
470 "ISO_2022,locale=zh,version=1",
471 :bin{ 1b24294141 }, "\x41", :intvector{ 4 },
472 :int{1}, :int{1}, "", ".", :bin{""}
473 }
474 // escape plus incomplete DBCS character
475 {
476 "ISO_2022,locale=zh,version=1",
477 :bin{ 1b2429410e41 }, "", :intvector{},
478 :int{1}, :int{1}, "truncated", ".", :bin{ 41 }
479 }
480 // all complete with DBCS character
481 {
482 "ISO_2022,locale=zh,version=1",
483 :bin{ 1b2429410e4141 }, "\u4eae", :intvector{ 5 },
484 :int{1}, :int{1}, "", ".", :bin{""}
485 }
486 // ISO-2022-CN-EXT with all subcharsets and shifts and with supplementary code points
487 {
488 "ISO-2022-CN-EXT",
489 :bin{ 1b2429411b242a480e41411b2429457e7c1b4e70341b242b4d1b2429477c341b4f664c2421 },
490 "\u4eae\u9f82\u56cd\u56cc\U0002a6d6\x30",
491 :intvector{ 9, 15, 19, 29, 33, 33, 35 },
492 :int{1}, :int{1}, "", ".", :bin{""}
493 }
494
495 // illegal and unsupported escape sequences
496 // SS2 without designator: illegal
497 {
498 "ISO-2022-CN-EXT",
499 :bin{ 411b4e2121 }, "\x41", :intvector{ 0 },
fd0068a8 500 :int{1}, :int{1}, "illesc", ".", :bin{ 1b }
374ca955
A
501 }
502 // G3 designator: recognized, but not supported for -CN (only for -CN-EXT)
503 {
504 "ISO-2022-CN",
505 :bin{ 411b242b491b4f2121 }, "\x41", :intvector{ 0 },
506 :int{1}, :int{1}, "unsuppesc", ".", :bin{ 1b242b49 }
507 }
d5d484b0
A
508 // empty segment 1 (using substitution and stop)
509 {
510 "ISO-2022-CN",
511 :bin{ 611b242941620e0f1b242a481b4e6a65630d0a },
512 "ab\uFFFD\u994Cc\u000D\u000A",
513 :intvector{ 0, 5, 7, 14, 16, 17, 18 },
514 :int{1}, :int{1}, "", "?", :bin{""}
515 }
516 {
517 "ISO-2022-CN",
518 :bin{ 611b242941620e0f1b242a481b4e6a65630d0a },
519 "ab",
520 :intvector{ 0, 5 },
521 :int{1}, :int{1}, "illesc", ".", :bin{"0f"}
522 }
523 // empty segment 2 (using substitution and stop)
524 {
525 "ISO-2022-CN",
526 :bin{ 611b242941620e1b24294768640f630d0a },
527 "ab\uFFFD\u5F70c\u000D\u000A",
528 :intvector{ 0, 5, 7, 11, 14, 15, 16 },
529 :int{1}, :int{1}, "", "?", :bin{""}
530 }
531 {
532 "ISO-2022-CN",
533 :bin{ 611b242941620e1b24294768640f630d0a },
534 "ab",
535 :intvector{ 0, 5 },
536 :int{1}, :int{1}, "illesc", ".", :bin{"1b242947"}
537 }
374ca955
A
538
539 // ISO-2022 SBCS
540 // [U_ENABLE_GENERIC_ISO_2022]
541 // The _generic_ ISO-2022 converter is disabled starting 2003-dec-03 (ICU 2.8).
542 // For details see the icu mailing list from 2003-dec-01 and the ucnv2022.c file.
543 // Language-specific variants of ISO-2022 continue to be available as listed below.
544 //{
545 // "ISO_2022",
546 // :bin{ 0008090a0d1a1c1f203f415c7d7e7f },
547 // "\x00\x08\t\n\r\x1a\x1c\x1f ?A\\}~\x7f",
548 // :intvector{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 },
549 // :int{1}, :int{1}, "", ".", :bin{""}
550 //}
551
d5d484b0
A
552 // HZ-GB-2312
553
46f4442e 554 // empty segment 1 (using substitution and stop)
d5d484b0
A
555 {
556 "HZ-GB-2312",
557 :bin{ 61627e7b7e7d6364 },
558 "ab\uFFFDcd",
559 :intvector{ 0, 1, 4, 6, 7 },
560 :int{1}, :int{1}, "", "?", :bin{""}
561 }
562 {
563 "HZ-GB-2312",
564 :bin{ 61627e7b7e7d63640d0a },
565 "ab",
566 :intvector{ 0, 1 },
567 :int{1}, :int{1}, "illesc", ".", :bin{"7e7d"}
568 }
46f4442e
A
569 // empty segment 2 & legal redundant switches (using substitution and stop)
570 {
571 "HZ-GB-2312",
572 :bin{ 61627e7b323b3f557e7b7e7b523b7e7d63647e7d65667e7d7e7d },
573 "ab\u4E0D\u7A7A\uFFFD\u4E00cdef\uFFFD",
574 :intvector{ 0, 1, 4, 6, 10, 12, 16, 17, 20, 21, 24 },
575 :int{1}, :int{1}, "", "?", :bin{""}
576 }
577 {
578 "HZ-GB-2312",
579 :bin{ 61627e7b323b3f557e7b7e7b523b7e7d63647e7d65667e7d7e7d },
580 "ab\u4E0D\u7A7A",
581 :intvector{ 0, 1, 4, 6 },
582 :int{1}, :int{1}, "illesc", ".", :bin{"7e7b"}
583 }
d5d484b0 584
374ca955
A
585 // DBCS-only extensions
586 {
587 "ibm-970",
588 :bin{ 617eece9b2eb },
589 "\x61\x7e\u4e00\ub000",
590 :intvector{ 0, 1, 2, 4 },
591 :int{1}, :int{1}, "", "?", :bin{""}
592 }
593
594 {
595 "ibm-971",
596 :bin{ 617eece9b2eb },
597 "\ufffd\u4e00\ub000",
598 :intvector{ 0, 2, 4 },
599 :int{1}, :int{1}, "", "?", :bin{""}
600 }
601
602 {
603 "ibm-16684",
604 :bin{ 430e4395ecc1404042e1 },
605 "\ufffd\u30C8\u30C8\u309A\u3000\u20ac",
606 :intvector{ 0, 2, 4, 4, 6, 8 },
607 :int{1}, :int{0}, "", "?", :bin{""}
608 }
609
610 {
611 "ibm-1399",
612 :bin{ 430e4395ecc140400fe1 },
613 "\uff62\u30C8\u30C8\u309A\u3000\u20ac",
614 :intvector{ 0, 2, 4, 4, 6, 9 },
615 :int{1}, :int{0}, "", "?", :bin{""}
616 }
617
618 // extensions
619 {
620 "ibm-1390",
621 :bin{ 430e4395ecc1 },
622 "\uff63\u30C8\u30C8\u309A",
623 :intvector{ 0, 2, 4, 4 },
624 :int{1}, :int{0}, "", "?", :bin{""}
625 }
626
627 {
628 "ibm-16684",
629 :bin{ ececec8bec8cec8d4386ecb5ecb6ecb7 },
630 "\ufffd\u31f6\u31f7\u31f8\u30ab\u304b\u309a\u304d\u309a\u304f\u309a",
631 :intvector{ 0, 2, 4, 6, 8, 10, 10, 12, 12, 14, 14 },
632 :int{1}, :int{0}, "", "?", :bin{""}
633 }
634
635 {
636 "ibm-1390",
637 :bin{ 43860eececec8bec8cec8d4386ecb5ecb6ecb7ecc10fec },
638 "\uff63\uff76\ufffd\u31f6\u31f7\u31f8\u30ab\u304b\u309a\u304d\u309a\u304f\u309a\u30C8\u309A\x1a",
639 :intvector{ 0, 1, 3, 5, 7, 9, 11, 13, 13, 15, 15, 17, 17, 19, 19, 22 },
640 :int{1}, :int{0}, "", "?", :bin{""}
641 }
642
643 {
644 "*test3",
645 :bin{ 00050601020b0701020a01020c },
646 "\u20ac\x05\x06\x0b\U00101234\U00023456\ufffd",
647 :intvector{ 0, 1, 2, 3, 6, 6, 7, 7, 10 },
648 :int{1}, :int{0}, "", "?", :bin{""}
649 }
650
651 // normal conversions
652 {
653 "UTF-16LE",
654 :bin{ 310000d801dc00d902dc320000d8330001dc3400 },
655 "1\U00010001\U000500022\ufffd3\ufffd4",
656 :intvector{ 0, 2, 2, 6, 6, 10, 12, 14, 16, 18 },
657 :int{1}, :int{0}, "", "?", :bin{""}
658 }
659 { "UTF-16LE", :bin{ 00 }, "", :intvector{}, :int{1}, :int{0}, "truncated", ".", :bin{ 00 } }
660 { "UTF-16LE", :bin{ 00d800 }, "", :intvector{}, :int{1}, :int{0}, "truncated", ".", :bin{ 00d800 } }
661
662 {
663 "UTF-16BE",
664 :bin{ 0031d800dc01d900dc020032d8000033dc010034 },
665 "1\U00010001\U000500022\ufffd3\ufffd4",
666 :intvector{ 0, 2, 2, 6, 6, 10, 12, 14, 16, 18 },
667 :int{1}, :int{0}, "", "?", :bin{""}
668 }
669 { "UTF-16BE", :bin{ 00 }, "", :intvector{}, :int{1}, :int{0}, "truncated", ".", :bin{ 00 } }
670 { "UTF-16BE", :bin{ d800dc }, "", :intvector{}, :int{1}, :int{0}, "truncated", ".", :bin{ d800dc } }
671
672 // e4b8 is a partial sequence
673 { "UTF-8", :bin{ 31e4ba8ce4b8 }, "1\u4e8c", :intvector{ 0, 1 }, :int{1}, :int{0}, "truncated", ".", :bin{ e4b8 } }
674 { "UTF-8", :bin{ 31e4ba8ce4b8 }, "1\u4e8c\ufffd", :intvector{ 0, 1, 4 }, :int{1}, :int{0}, "", "?", :bin{""} }
675
676 // LMBCS with escape callback (1292a0 is unassigned)
677 {
678 "LMBCS",
679 :bin{ 12c9501292a01292a1 },
680 "\u4e2e%X12%X92%XA0\ue5c4",
681 :intvector{ 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 6 },
682 :int{1}, :int{0}, "", "&", :bin{""}
683 }
684
685 // IMAP-mailbox-name with SUB
686 // a<DEL> a&AB~ a&AB\x0c a&AB- a&AB. a&.
687 {
688 "IMAP-mailbox-name",
689 :bin{ 617f612641427e612641420c612641422d612641422e61262e },
690 "a\ufffda\ufffda\ufffda\ufffda\ufffda\ufffd",
691 :intvector{ 0, 1, 2, 4, 7, 9, 12, 14, 17, 19, 22, 23 },
692 :int{1}, :int{0}, "", "?", :bin{""}
693 }
694
695 // using testdata_test1.cnv
696 { "*test1", :bin{ 000506070809 }, "\u20ac\x05\x06\U00101234\ufffd\ufffd", :intvector{ 0, 1, 2, 3, 3, 4, 5 }, :int{1}, :int{0}, "", "", :bin{""} }
697
698 // surrogates in CESU-8
699 { "CESU-8", :bin{ eda080eda081edb081 }, "\ud800\U00010401", :intvector{ 0, 3, 6 }, :int{1}, :int{0}, "", "", :bin{""} }
700 // e080 is a partial sequence
701 { "UTF-8", :bin{ 31ffe4ba8ce08061 }, "1\ufffd\u4e8c\ufffda", :intvector{ 0, 1, 2, 5, 7 }, :int{0}, :int{0}, "", "", :bin{ e080 } }
702 // fbbfbfbfbf exceedes U+10ffff
703 { "UTF-8", :bin{ 31fbbfbfbfbf61 }, "1\ufffda", :intvector{ 0, 1, 6 }, :int{0}, :int{0}, "", "", :bin{ fbbfbfbfbf } }
704
705 // lead byte a2 without trail byte
706 { "ibm-1363", :bin{ a2aea2 }, "\u00a1", :intvector{ 0 }, :int{1}, :int{0}, "truncated", ".", :bin{ a2 } }
707 { "ibm-1363", :bin{ a2aea2 }, "\u00a1\u001a", :intvector{ 0, 2 }, :int{1}, :int{0}, "", "?", :bin{""} }
708
709 // simple sample, no error handling
710 { "UTF-8", :bin{ 61F48FBFBF }, "a\U0010FFFF", :intvector{ 0, 1, 1 }, :int{1}, :int{0}, "", "", :bin{""} }
46f4442e
A
711 // Headers { "charset", "bytes", "unicode", "offsets", "flush", "fallbacks", "errorCode", "callback", "invalidChars" }
712 {
713 "iscii",
714 :bin{ EF4BC0E9BFE9E8D80AEF4AC0D4BFD4E8D80AEF4838B30AEF4939B30AEF4A3AB30AEF4B3BB30A},
715 "\u0A22\u0A3C\u0A5C\u0A4D\u0A39\u000A" /* Gurmukhi test */
716 "\u0AA2\u0AB5\u0AA1\u0AB5\u0ACD\u0AB9\u000A" /* Gujarati test */
717 "\u0038\u0C95\u000A" /* Kannada test */
718 "\u0039\u0D15\u000A" /* Malayalam test */
719 "\u003A\u0A95\u000A" /* Gujarati test */
720 "\u003B\u0A15\u000A" /* Punjabi test */,
721 :intvector { 2, 3, 5, 6, 7, 8, 11, 12, 13, 14, 15, 16, 17, 20, 21, 22, 25, 26, 27, 30, 31, 32, 35, 36, 37 },
722 :int{1}, :int{0}, "", "", :bin{ "" }
723 }
724 {
725 "iscii-gur",
726 :bin{3BB30AC0E9BFE9E8D80AEF43C0E9BFE9E8D80A3BB30AEF403BB30A},
727 "\u003b\u0a15\u000a" /* Easy characters */
728 "\u0a22\u0a3c\u0a5c\u0a4d\u0a39\u000a" /* Gurmukhi test */
729 "\u09dd\u09dc\u09cd\u09b9\u000a" /* Switch script: to Bengali*/
730 "\u003b\u0a15\u000a" /* Easy characters - new line" so should default!*/
731 "\u003b\u0a15\u000a", /* Back to Gurmukhi*/
732 :intvector { 0, 1, 2, 3, 4, 6, 7, 8, 9, 13, 15, 16, 17, 18, 19, 20, 21, 24, 25, 26 },
733 :int{1}, :int{0}, "", "", :bin{ "" }
734 }
735 { // Verify Supplementary support
736 "Big5-HKSCS",
737 :bin{ fcfcfcfd },
738 "\U000233E6\U00026DA0",
739 :intvector{ 0, 0, 2, 2 },
740 :int{1}, :int{0}, "", "?", :bin{""}
741 }
742 { // Verify non-supplementary support
743 "big5-hkscs:unicode3.0",
744 :bin{ fcfcfcfd },
745 "\uE1D4\uE1D5",
746 :intvector{ 0, 2 },
747 :int{1}, :int{0}, "", "?", :bin{""}
748 }
749 { // Verify gb18030 enumeration
750 "gb18030",
751 :bin{ 8130D2398130D3308136A5318136A532 },
752 "\u0450\u0452\u200F\u2011",
753 :intvector{ 0, 4, 8, 12 },
754 :int{1}, :int{0}, "", "?", :bin{""}
755 }
756 // Improve coverage of ISCII
757 {
758 "iscii-bng",
759 :bin{ f0a0f0b0b8 },
760 "",
761 :intvector{},
762 :int{1}, :int{0}, "", "0", :bin{""}
763 }
764 // Test iso-2022-jp-2 miscellaneous symbols
765 {
766 "iso-2022-jp-2",
767 :bin{ 1b242843224f224e1b2842 },
768 "\u260E\u260F",
769 :intvector{ 4, 6 },
770 :int{1}, :int{0}, "", ".", :bin{""}
771 }
374ca955
A
772 }
773 }
774
775 // --------------------------------------------------------------------- ***
776
777 fromUnicode {
778 Headers { "charset", "unicode", "bytes", "offsets", "flush", "fallbacks", "errorCode", "callback", "invalidUChars" }
779 Cases {
46f4442e
A
780 // Test bug 6071 (1:2 Unicode:charset SBCS mapping).
781 {
782 "*test1bmp",
783 "e@t",
784 :bin{ 05000709 },
785 :intvector{ 0,1,2,2 },
786 :int{1}, :int{0}, "", "?", ""
787 }
788 // improve coverage of ISO-2022-JP converter with hardcoded JIS X 0201 and
789 // using the Shift-JIS table for JIS X 0208 (ticket #5797)
790 {
791 "ISO-2022-JP",
792 "\u203e\xa5\u4e00\ufa10\u6f3e\u0391",
793 :bin{ 1b284a7e5c1b2442306c222e5f2126211b2842 },
794 :intvector{ 0,0,0,0,1,2,2,2,2,2,3,3,4,4,5,5,5,5,5 },
795 :int{1}, :int{0}, "", "?=\u3013", "" // U+3013 Geta Mark converts to 222e
796 }
797 // Verify that mappings that would result in byte values outside 20..7F (for SBCS)
798 // or 21..7E (for DBCS) are not used.
799 // ibm-9005_X110-2007.ucm (ISO 8859-7, <ESC>.F=1b2e46):
800 // <U009F> \x9F |0 (also in ISO 8859-1)
801 // <U0387> \xB7 |1
802 // windows-949-2000 (KSC_5601, <ESC>$(C=1b242843):
803 // <UC829> \xA0\xA1 |0
804 // <UD4FE> \xC0\x41 |0
805 // <UD79D> \xC8\xFE |0
806 {
807 "JIS8", // =ISO_2022,locale=ja,version=4
808 "\u009f\u0387\uc829\ud4fe\ud79d",
809 :bin{ 1a1b2e461b4e371a1a1b242843487e1b2842 },
810 :intvector{ 0,1,1,1,1,1,1,2,3,4,4,4,4,4,4,4,4,4 },
811 :int{1}, :int{1}, "", "?", ""
812 }
813 // Ticket 5483: ISO 2022 converter incorrectly using fallback mapping
814 // Verify that a roundtrip mapping is used even when a fallback mapping is
815 // available in the current state.
816 // U+FF61 is handled in code
817 // jisx-208.ucm (<ESC>$B=1b2442):
818 // <U30FE> \x21\x34 |0
819 // <UFF5D> \x21\x51 |0 and
820 // ibm-897_P100-1995.ucm (JIS X 0201, <ESC>(J=1b284a):
821 // <UFF5D> \x7D |1
822 // ibm-9005_X110-2007.ucm (ISO 8859-7, <ESC>.F=1b2e46):
823 // <U03D5> \xF6 |1
824 // <U2015> \xAF |0
825 // <UFF5D> \x7D |1 (not legal for ISO 2022)
826 // windows-949-2000 (KSC_5601, <ESC>$(C=1b242843):
827 // <UAC00> \xB0\xA1 |0
828 // <UFF5D> \xA3\xFD |0
829 // <U223C> \xA1\xAD |0 (in extension table)
830 {
831 "JIS8", // =ISO_2022,locale=ja,version=4
832 "a\uff61\u03d5\uff5d\uac00\u223c\uff5d\u30fe\uff5d", // Make it switch to ISO-8859-7, KSC 5601 and JIS X 0208.
833 :bin{ 61a11b2e461b4e761b244221511b2428433021212d237d1b2442213421511b2842 },
834 :intvector{ 0,1,2,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,4,5,5,6,6,7,7,7,7,7,8,8,8,8,8 },
835 :int{1}, :int{1}, "", "?", ""
836 }
837 // Code coverage for UTF-8->SBCS conversion (ucnv_convertEx()).
838 // Test code path for non-roundtripping ASCII characters
839 // (try EBCDIC SBCS, and IBM PC SBCS with control code rotation).
840 {
841 "ibm-37",
842 "a\x85c",
843 :bin{ 811583 },
844 :intvector{ 0,1,2 },
845 :int{1}, :int{0}, "", "?", ""
846 }
847 {
848 "ibm-850",
849 "a\x1ac",
850 :bin{ 617f63 },
851 :intvector{ 0,1,2 },
852 :int{1}, :int{0}, "", "?", ""
853 }
854 // Code coverage for UTF-8->DBCS conversion (ucnv_convertEx()).
855 // Test code path for non-roundtripping ASCII characters
856 // (try IBM PC DBCS with control code rotation).
857 {
858 "ibm-943",
859 "a\x1ac\u30a1\x7ff",
860 :bin{ 617f6383401c66 },
861 :intvector{ 0,1,2,3,3,4,5 },
862 :int{1}, :int{0}, "", "?", ""
863 }
864 // SCSU regression test.
73c04bcf
A
865 {
866 "SCSU",
867 "1\U00010001\u0085\U000500022\ud8003\udc014\ue001",
868 :bin{ 310be0008102050fd900dc02e7320efffd330efffd34186881 },
869 :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 },
870 :int{1}, :int{0}, "", "?", ""
871 }
872 // Test substitution strings.
873 {
874 "windows-1252", // stateless MBCS with WriteSub(), should internally set char *
875 "a\ufdd0c",
876 :bin{ 61402421402463 },
877 :intvector{ 0,1,1,1,1,1,2 },
878 :int{1}, :int{0}, "", "?=@$!@$", ""
879 }
46f4442e
A
880 {
881 "windows-1252",
882 "1\U00010001\u0085\U000500022\ud8003\udc014\ue001",
883 :bin{ 311a1a1a321a331a341a },
884 :intvector{ 0,1,3,4,6,7,8,9,10,11 },
885 :int{1}, :int{0}, "", "?", ""
886 }
887 {
888 "windows-1252",
889 "\uD87E", // lone surrogate can cause an offset overflow
890 :bin{ 1a },
891 :intvector{ 0 },
892 :int{1}, :int{0}, "", "?", ""
893 }
894 {
895 "windows-1252",
896 "\uD87E", // lone surrogate can cause an offset overflow
897 :bin{ 6875683f },
898 :intvector{ 0,0,0,0 },
899 :int{1}, :int{0}, "", "?=huh?", "" // Use a long substitution character
900 }
901 {
902 "*test4",
903 "\u30ab", // An incomplete multi-codepoint character
904 :bin{ ff },
905 :intvector{ 0 },
906 :int{1}, :int{0}, "", "?", ""
907 }
73c04bcf
A
908 {
909 "ibm-930", // stateful MBCS
910 "a\ufdd0\u4e00\ufdd0e",
911 :bin{ 620e4bce0f400e45414bce0f4066 },
912 :intvector{ 0,1,1,1,1,1,2,2,2,3,3,3,3,4 },
913 :int{1}, :int{0}, "", "?=\u4e01 ", ""
914 }
915 {
916 "iso-2022-jp",
917 "a\x1bc", // Unicode ESC must not occur as a character
918 :bin{ 6163 },
919 :intvector{ 0,2 },
920 :int{1}, :int{0}, "", "?=", "" // empty substitution string
921 }
922 {
923 "iso-2022-cn",
924 "a\x1bc", // Unicode ESC must not occur as a character
925 :bin{ 61202063 },
926 :intvector{ 0,1,1,2 },
927 :int{1}, :int{0}, "", "?= ", ""
928 }
929 {
930 "iso-2022-cn",
931 "a\x1bc", // Unicode ESC must not occur as a character
932 :bin{ 611b2429410e523b0f2063 },
933 :intvector{ 0,1,1,1,1,1,1,1,1,1,2 },
934 :int{1}, :int{0}, "", "?=\u4e00 ", ""
935 }
936 {
937 "us-ascii",
938 "a\x85c",
939 :bin{ 61402421402463 },
940 :intvector{ 0,1,1,1,1,1,2 },
941 :int{1}, :int{0}, "", "?=@$!@$", ""
942 }
943 // ISO 2022-CN: test a single-byte subchar, j5171
944 {
945 "iso-2022-cn",
946 "a\x1bc", // Unicode ESC must not occur as a character
947 :bin{ 612163 },
948 :intvector{ 0,1,2 },
949 :int{1}, :int{0}, "", "?\x00\x21", ""
950 }
951 // UTF-16/32: do not output a BOM if there is no data at all
952 {
953 "UTF-16",
954 "",
955 :bin{ "" },
956 :intvector{ },
957 :int{1}, :int{1}, "", "?", ""
958 }
959 {
960 "UTF-32",
961 "",
962 :bin{ "" },
963 :intvector{ },
964 :int{1}, :int{1}, "", "?", ""
965 }
966
967 // do not convert SO/SI/ESC
968 {
969 "iso-2022-jp",
970 "A\x0eB\x0f\x09\x1bC",
971 :bin{ 411a421a091a43 },
972 :intvector{ 0,1,2,3,4,5,6 },
973 :int{1}, :int{1}, "", "?", ""
974 }
975 {
976 "iso-2022-cn",
977 "A\x0eB\x0f\x09\x1bC",
978 :bin{ 411a421a091a43 },
979 :intvector{ 0,1,2,3,4,5,6 },
980 :int{1}, :int{1}, "", "?", ""
981 }
982 {
983 "iso-2022-kr",
984 "A\x0eB\x0f\x09\x1bC",
985 :bin{ 1b242943411a421a091a43 },
986 :intvector{ -1,-1,-1,-1,0,1,2,3,4,5,6 },
987 :int{1}, :int{1}, "", "?", ""
988 }
989 {
990 "ibm-25546",
991 "A\x0eB\x0f\x09\x1bC",
992 :bin{ 1b242943411a421a091a43 },
993 :intvector{ -1,-1,-1,-1,0,1,2,3,4,5,6 },
994 :int{1}, :int{1}, "", "?", ""
995 }
996
997 // test ISO 8859-1/7 vs. JIS X 0201
998 {
999 "ISO-2022-JP-2",
1000 "?@A\u00e4\u03b1\u203EB",
1001 :bin{ 3f40411B2E411B4E641B2E461B4E611B284A7E421B2842 },
1002 :intvector{ 0,1,2,3,3,3,3,3,3,4,4,4,4,4,4,5,5,5,5,6,6,6,6 },
1003 :int{1}, :int{1}, "", "?", ""
1004 }
1005
374ca955
A
1006 // Improve ucnv_ext.c code coverage:
1007 // There will be a partial match up to the lead surrogate of U+603ff
1008 // which then results in one more unit in the prefetch buffer
1009 // than the match length when converting one code unit at a time.
1010 // See ucnv_extContinueMatchFromU() comment
1011 // "the match did not use all of preFromU[] - keep the rest for replay"
1012 {
1013 "*test3",
1014 "\U00101234\U00101234\U00050005\U000603ff",
1015 :bin{ 07070001020e05ff },
1016 :intvector{ 0, 2, 2, 2, 2, 2, 2, 6 },
1017 :int{1}, :int{0}, "", "?", ""
1018 }
1019
1020 // test that ISO-2022-JP encodes ASCII as itself
1021 {
1022 "ISO-2022-JP",
1023 "?@ABCDEFG",
1024 :bin{ 3f4041424344454647 },
1025 :intvector{ 0,1,2,3,4,5,6,7,8 },
1026 :int{1}, :int{1}, "", "?", ""
1027 }
1028 // test that ISO-2022-CN encodes ASCII as itself
1029 {
1030 "ISO-2022-CN",
1031 "?@ABCDEFG",
1032 :bin{ 3f4041424344454647 },
1033 :intvector{ 0,1,2,3,4,5,6,7,8 },
1034 :int{1}, :int{1}, "", "?", ""
1035 }
1036
1037 // moved from cintltst /tsconv/nccbtst/TestSkipCallBack
1038 {
1039 "iso-2022-jp",
1040 "\u3000\xe9\u3001",
1041 :bin{ 1b2442212121221b2842 },
1042 :intvector{ 0,0,0,0,0,2,2,2,2,2 },
1043 :int{1}, :int{1}, "", "0", ""
1044 }
1045 // moved from cintltst /tsconv/nccbtst/TestSubCallBack
1046 {
1047 "iso-2022-jp",
1048 "A\xe9B\xe9\u3000",
1049 :bin{ 411a421a1b244221211b2842 },
1050 :intvector{ 0,1,2,3,4,4,4,4,4,4,4,4 },
1051 :int{1}, :int{1}, "", "?", ""
1052 }
1053 // moved from cintltst /tsconv/nccbtst/TestSubWithValueCallBack
1054 {
1055 "iso-2022-jp",
1056 "A\xe9B\xe9\u3000",
1057 :bin{ 41255530304539422555303045391b244221211b2842 },
1058 :intvector{ 0,1,1,1,1,1,1,2,3,3,3,3,3,3,4,4,4,4,4,4,4,4 },
1059 :int{1}, :int{1}, "", "&", ""
1060 }
1061 {
1062 "iso-2022-cn",
1063 "\u4e00\u3712\u4e01",
1064 :bin{ 1b2429410e523b0f2555333731320e36210f },
1065 :intvector{ 0,0,0,0,0,0,0,1,1,1,1,1,1,1,2,2,2,2 },
1066 :int{1}, :int{1}, "", "&", ""
1067 }
1068 {
1069 "iso-2022-cn",
1070 "A\u3712\u4e00",
1071 :bin{ 412555333731321b2429410e523b0f },
1072 :intvector{ 0,1,1,1,1,1,1,2,2,2,2,2,2,2,2 },
1073 :int{1}, :int{1}, "", "&", ""
1074 }
1075 {
1076 "iso-2022-cn",
1077 "\u3000\u3712\u3001",
1078 :bin{ 1b2429410e21210f2555333731320e21220f },
1079 :intvector{ 0,0,0,0,0,0,0,1,1,1,1,1,1,1,2,2,2,2 },
1080 :int{1}, :int{1}, "", "&", ""
1081 }
1082
1083 // moved from cintltst /tsconv/nucnvtst/TestJIS
1084 {
1085 "JIS",
1086 "\uFF81\uFF82\u30EC\u30ED\u30EE\u30EF\uFF93\uFF94\uFF95\uFF96\uFF97\uFF98",
1087 :bin{ 1b244225412544256c256d256e256F25622564256625682569256a1b2842 },
1088 :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 },
1089 :int{1}, :int{1}, "", "?", ""
1090 }
1091 {
1092 "JIS7",
1093 "\uFF81\uFF82\u30EC\u30ED\u30EE\u30EF\uFF93\uFF94\uFF95\uFF96\uFF97\uFF98",
1094 :bin{ 0e41420f1b2442256c256d256e256F0e5354555657580f1b2842 },
1095 :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 },
1096 :int{1}, :int{1}, "", "?", ""
1097 }
1098 {
1099 "JIS8",
1100 "\uFF81\uFF82\u30EC\u30ED\u30EE\u30EF\uFF93\uFF94\uFF95\uFF96\uFF97\uFF98",
1101 :bin{ C1C21b2442256c256d256e256F1b284AD3D4D5D6D7D81b2842 },
1102 :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 },
1103 :int{1}, :int{1}, "", "?", ""
1104 }
1105
1106 // moved from cintltst /tsconv/ncnvtst/TestErrorBehaviour
1107 {
1108 "iso-2022-jp",
1109 "\u3000\x50\udc01\u3001",
1110 :bin{ 1B244221211B2842501A1B24422122 },
1111 :intvector{ 0,0,0,0,0,1,1,1,1,2,3,3,3,3,3 },
1112 :int{0}, :int{1}, "", "?", "\udc01"
1113 }
1114 {
1115 "iso-2022-jp",
1116 "\u3000\x50\udc01\u3001",
1117 :bin{ 1B244221211B2842501A1B244221221b2842 },
1118 :intvector{ 0,0,0,0,0,1,1,1,1,2,3,3,3,3,3,3,3,3 },
1119 :int{1}, :int{1}, "", "?", ""
1120 }
1121 {
1122 "iso-2022-kr",
1123 "\x61\u4e00\udc01\u4e00",
1124 :bin{ 1b242943610e6c690f1a0e6c69 },
1125 :intvector{ -1,-1,-1,-1,0,1,1,1,2,2,3,3,3 },
1126 :int{0}, :int{1}, "", "?", "\udc01"
1127 }
1128 {
1129 "iso-2022-kr",
1130 "\x61\u4e00\udc01\u4e00",
1131 :bin{ 1b242943610e6c690f1a0e6c690f },
1132 :intvector{ -1,-1,-1,-1,0,1,1,1,2,2,3,3,3,3 },
1133 :int{1}, :int{1}, "", "?", ""
1134 }
1135
1136 // ISO-2022-KR
1137 {
1138 "ibm-25546",
1139 "AB\uc88b\U00050005\uacccC",
1140 :bin{ 1b24294341420e41410f7b552b35303030357d0e306a0f43 },
1141 :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 },
1142 :int{1}, :int{1}, "", "&U", ""
1143 }
1144 {
1145 "ibm-25546",
1146 "AB\uc88b\U00050005\uacccC",
1147 :bin{ 1b24294341420e41410f1a0e306a0f43 },
1148 :intvector{ -1,-1,-1,-1,0,1,2,2,2,3,3,5,5,5,6,6 },
1149 :int{1}, :int{1}, "", "?\x00\x1a", ""
1150 }
1151 {
1152 "ibm-25546",
1153 "AB\uc88b\U00050005\uacccC",
1154 :bin{ 1b24294341420e41412f7e306a0f43 },
1155 :intvector{ -1,-1,-1,-1,0,1,2,2,2,3,3,5,5,6,6 },
1156 :int{1}, :int{1}, "", "?", ""
1157 }
1158 {
1159 "ibm-25546",
1160 "AB\uc88b\U00050005\uaccc",
1161 :bin{ 1b24294341420e41412f7e306a0f },
1162 :intvector{ -1,-1,-1,-1,0,1,2,2,2,3,3,5,5,5 },
1163 :int{1}, :int{1}, "", "?", ""
1164 }
1165 {
1166 "ISO-2022-KR",
1167 "AB\uc88b\U00050005\uacccC",
1168 :bin{ 1b24294341420e41410f7b552b35303030357d0e306a0f43 },
1169 :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 },
1170 :int{1}, :int{1}, "", "&U", ""
1171 }
1172 {
1173 "ISO-2022-KR",
1174 "AB\uc88b\U00050005\uacccC",
1175 :bin{ 1b24294341420e41410f1a0e306a0f43 },
1176 :intvector{ -1,-1,-1,-1,0,1,2,2,2,3,3,5,5,5,6,6 },
1177 :int{1}, :int{1}, "", "?", ""
1178 }
1179 {
1180 "ISO-2022-KR",
1181 "AB\uc88b\U00050005\uacccC",
1182 :bin{ 1b24294341420e41412f7e306a0f43 },
1183 :intvector{ -1,-1,-1,-1,0,1,2,2,2,3,3,5,5,6,6 },
1184 :int{1}, :int{1}, "", "?\x00\x2f\x7e", ""
1185 }
1186 {
1187 "ISO-2022-KR",
1188 "AB\uc88b\U00050005\uaccc",
1189 :bin{ 1b24294341420e41412f7e306a0f },
1190 :intvector{ -1,-1,-1,-1,0,1,2,2,2,3,3,5,5,5 },
1191 :int{1}, :int{1}, "", "?\x00\x2f\x7e", ""
1192 }
46f4442e
A
1193 // ISO-2022-KR
1194 {
1195 "ibm-25546",
1196 "AB\uc88b\U00050005\uacccC",
1197 :bin{ 1b24294341420e41410f5c3530303035200e306a0f43 },
1198 :intvector{ -1,-1,-1,-1,0,1,2,2,2,3,3,3,3,3,3,3,3,5,5,5,6,6 },
1199 :int{1}, :int{1}, "", "&S", ""
1200 }
374ca955
A
1201
1202 // ISO-2022-JP-2 with G2 designator & SS2 shift
1203 {
1204 "ISO-2022-JP-2",
1205 "CF\u758f\u038f\u7591",
1206 :bin{ 43461b244241411b2e461b4e3f353f1b2842 },
1207 :intvector{ 0,1,2,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4 },
1208 :int{1}, :int{1}, "", ".", ""
1209 }
1210 // JIS7 with Katakana
1211 {
1212 "JIS7",
1213 "AB\uff81\uff82AB",
1214 :bin{ 41420e41420f4142 },
1215 :intvector{ 0,1,2,2,3,4,4,5 },
1216 :int{1}, :int{1}, "", ".", ""
1217 }
1218 // JIS7 with shift to ASCII at the very end
1219 {
1220 "JIS7",
1221 "AB\uff81\uff82",
1222 :bin{ 41420e41420f },
1223 :intvector{ 0,1,2,2,3,3 },
1224 :int{1}, :int{1}, "", ".", ""
1225 }
1226 // JIS8 with Katakana
1227 {
1228 "JIS8",
1229 "A\uff81\\\xa5\uff82B",
1230 :bin{ 41c15c1b284a5cc2421b2842 },
1231 :intvector{ 0,1,2,3,3,3,3,4,5,5,5,5 },
1232 :int{1}, :int{1}, "", ".", ""
1233 }
1234
1235 // ISO-2022-CN-EXT with all subcharsets and shifts and with supplementary code points
1236 {
1237 "ISO-2022-CN-EXT",
1238 "\u4eae\u9f82\u56cd\u56cc\U0002a6d6\x30",
1239 :bin{ 1b2429410e41411b2429457e7c1b242a481b4e70341b2429477c341b242b4d1b4f664c0f30 },
1240 :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 },
1241 :int{1}, :int{1}, "", ".", ""
1242 }
1243 // ISO-2022-CN-EXT with shift to ASCII at the very end
1244 {
1245 "ISO-2022-CN-EXT",
1246 "\u4eae\u9f82\u56cd\u56cc\U0002a6d6",
1247 :bin{ 1b2429410e41411b2429457e7c1b242a481b4e70341b2429477c341b242b4d1b4f664c0f },
1248 :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 },
1249 :int{1}, :int{1}, "", ".", ""
1250 }
1251 // ISO-2022-CN-EXT without flush so do not shift to ASCII at the very end
1252 {
1253 "ISO-2022-CN-EXT",
1254 "\u4eae\u9f82\u56cd\u56cc\U0002a6d6",
1255 :bin{ 1b2429410e41411b2429457e7c1b242a481b4e70341b2429477c341b242b4d1b4f664c },
1256 :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 },
1257 :int{0}, :int{1}, "", ".", ""
1258 }
1259
1260 // windows-936 vs. ibm-1386
1261 {
1262 "ibm-1386",
1263 "\x1a\u20ac\u5555\x80\x81\U00055555",
1264 :bin{ 7fa2e3dffb7f7fa1a1 },
1265 :intvector{ 0, 1, 1, 2, 2, 3, 4, 5, 5 },
1266 :int{1}, :int{1}, "", "?", ""
1267 }
1268 {
1269 "windows-936",
1270 "\x1a\u20ac\u5555\x80\x81\U00055555",
1271 :bin{ 1a80dffb3f3f3f },
1272 :intvector{ 0, 1, 2, 2, 3, 4, 5 },
1273 :int{1}, :int{1}, "", "?", ""
1274 }
1275
1276 // verify that if a conversion table does not have any mapping for U+0000,
1277 // then there will not even be a phantom fallback to 00
1278 {
1279 "ibm-971",
1280 "\x00",
1281 :bin{ affe },
1282 :intvector{ 0, 0 },
1283 :int{1}, :int{1}, "", "?", ""
1284 }
1285
1286 {
1287 "*test4",
1288 "\x00",
1289 :bin{ ff },
1290 :intvector{ 0 },
1291 :int{1}, :int{1}, "", "?", ""
1292 }
1293
1294 // extension in testdata
1295 {
1296 "*test4x",
1297 "\u20ac\x09",
1298 :bin{ 0009 },
1299 :intvector{ 0, 1 },
1300 :int{1}, :int{1}, "", "?", ""
1301 }
1302
1303 // DBCS-only extensions
1304 {
1305 "ibm-970",
1306 "\x61\uffa1\u2015\ub000",
1307 :bin{ 611aa1aab2eb },
1308 :intvector{ 0, 1, 2, 2, 3, 3 },
1309 :int{1}, :int{1}, "", "?", ""
1310 }
1311
1312 {
1313 "ibm-971",
1314 "\x61\uffa1\u2015\ub000",
1315 :bin{ affeaffeaffeb2eb },
1316 :intvector{ 0, 0, 1, 1, 2, 2, 3, 3 },
1317 :int{1}, :int{1}, "", "?", ""
1318 }
1319
1320 {
1321 "ibm-1390,swaplfnl",
1322 "\uff63\u30C8\u30C8\u309A\u3000\x41\u20ac\x0a",
1323 :bin{ 430e4395ecc140400fc1e115 },
1324 :intvector{ 0, 1, 1, 1, 2, 2, 4, 4, 5, 5, 6, 7 },
1325 :int{1}, :int{0}, "", "?", ""
1326 }
1327
1328 {
1329 "ibm-16684",
1330 "\uff63\u30C8\u30C8\u309A\u3000\x41\u20ac\x0a",
1331 :bin{ fefe4395ecc14040fefe42e1fefe },
1332 :intvector{ 0, 0, 1, 1, 2, 2, 4, 4, 5, 5, 6, 6, 7, 7 },
1333 :int{1}, :int{0}, "", "?", ""
1334 }
1335
1336 {
1337 "ibm-1399",
1338 "\uff63\u30C8\u30C8\u309A\u3000\x41\u20ac\x0a",
1339 :bin{ 440e4395ecc140400fc1e125 },
1340 :intvector{ 0, 1, 1, 1, 2, 2, 4, 4, 5, 5, 6, 7 },
1341 :int{1}, :int{0}, "", "?", ""
1342 }
1343
1344 // <subchar1> from |2 mappings
1345 {
1346 "ibm-1390",
1347 "\x0e\x0f\u0901\U00050000\uffe8\uffee",
1348 :bin{ 3f3f0efefefefe0f3f3f },
1349 :intvector{ 0, 1, 2, 2, 2, 3, 3, 5, 5, 6 },
1350 :int{1}, :int{1}, "", "?", ""
1351 }
1352
1353 // <subchar1> from |2 mappings, and also contains a fallback to 00
1354 {
1355 "*test4",
1356 "\u20ac\u20ad\U00050005\U00023456\U0010ffff\x30",
1357 :bin{ 0000e10102030affff },
1358 :intvector{ 0, 1, 2, 4, 4, 4, 4, 6, 8 },
1359 :int{1}, :int{1}, "", "?", ""
1360 }
1361
1362 // setting a <subchar> resets the <subchar1>
1363 {
1364 "*test4",
1365 "\u20ac\u20ad\U00050005\U00023456\U0010ffff\x30",
1366 :bin{ 00000102030f0102030a0102030f0102030f },
1367 :intvector{ 0, 1, 2, 2, 2, 2, 4, 4, 4, 4, 6, 6, 6, 6, 8, 8, 8, 8 },
1368 :int{1}, :int{1}, "", "?\x00\x01\x02\x03\x0f", ""
1369 }
1370
1371 // fallback to 00 with old single-byte data structure
1372 {
1373 "*test1",
1374 "\u20ac\u20ad\U00101234\U00050000",
1375 :bin{ 000007ff },
1376 :intvector{ 0, 1, 2, 4 },
1377 :int{1}, :int{1}, "", "?", ""
1378 }
1379
1380 // extensions
1381 {
1382 "ibm-1390",
1383 "\u025a\u025a\u0300\u025a\u0301\u025a\u0302\uffe8\U0002a0f9",
1384 :bin{ 0ed896eccaeccbd896ea530f3f0eb7c20f },
1385 :intvector{ 0, 0, 0, 1, 1, 3, 3, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8 },
1386 :int{1}, :int{0}, "", "?", ""
1387 }
1388
1389 {
1390 "*test3",
1391 "\xc4\xc4\xc4\U00101234\xc4\xc4\U00101234\x05",
1392 :bin{ ffffff070501020c },
1393 :intvector{ 0, 1, 2, 3, 5, 5, 5, 5 },
1394 :int{1}, :int{0}, "", "?", ""
1395 }
1396
1397 {
1398 "*test3",
1399 "\U00101234\U00101234\U00050005\U00101234\U00050005\U00060006",
1400 :bin{ 07070001020e05070001020f09 },
1401 :intvector{ 0, 2, 2, 2, 2, 2, 2, 6, 6, 6, 6, 6, 6 },
1402 :int{1}, :int{0}, "", "?", ""
1403 }
1404
1405 // normal conversions
1406 {
1407 "UTF-16LE",
1408 "1\U00010001\U000500022\ud8003\udc014",
1409 :bin{ 310000d801dc00d902dc3200fdff3300fdff3400 },
1410 :intvector{ 0, 0, 1, 1, 1, 1, 3, 3, 3, 3, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9 },
1411 :int{1}, :int{0}, "", "?", ""
1412 }
1413 { "UTF-16LE", "\ud800", :bin{""}, :intvector{}, :int{1}, :int{0}, "truncated", ".", "\ud800" }
1414
1415 {
1416 "UTF-16BE",
1417 "1\U00010001\U000500022\ud8003\udc014",
1418 :bin{ 0031d800dc01d900dc020032fffd0033fffd0034 },
1419 :intvector{ 0, 0, 1, 1, 1, 1, 3, 3, 3, 3, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9 },
1420 :int{1}, :int{0}, "", "?", ""
1421 }
1422 { "UTF-16BE", "\ud800", :bin{""}, :intvector{}, :int{1}, :int{0}, "truncated", ".", "\ud800" }
1423
73c04bcf
A
1424 {
1425 "SCSU",
1426 "1\U00010001\u00082\ud8003\udc014\ue001",
1427 :bin{ 310be000810108320efffd330efffd34186881 },
1428 :intvector{ 0, 1, 1, 1, 1, 3, 3, 4, 5, 5, 5, 6, 7, 7, 7, 8, 9, 9, 9 },
1429 :int{1}, :int{0}, "", "?", ""
1430 }
1431
374ca955
A
1432 // escape callback
1433 {
1434 "ISCII",
1435 "A\u0901\U00023456\u0902B\U00023456C",
1436 :bin{ 41ef42a1255544383444255544433536a24225554438344425554443353643 },
1437 :intvector{
1438 0,
1439 1,1,1,
1440 2,2,2,2,2,2,
1441 2,2,2,2,2,2,
1442 4,
1443 5,
1444 6,6,6,6,6,6,
1445 6,6,6,6,6,6,
1446 8
1447 },
1448 :int{1}, :int{0}, "", "&", ""
1449 }
1450
1451 // escape callback (hex)
1452 {
1453 "iso-2022-jp",
1454 "\u3000\U00023456\u3001\U00023456B\u901c",
1455 :bin{ 1b244221211b284226237832333435363b1b244221221b284226237832333435363b42262378393031433b },
1456 :intvector{
1457 0,0,0,0,0,
1458 1,1,1,1,1,1,1,1,1,1,1,1,
1459 3,3,3,3,3,
1460 4,4,4,4,4,4,4,4,4,4,4,4,
1461 6,
1462 7,7,7,7,7,7,7,7
1463 },
1464 :int{1}, :int{0}, "", "&X", ""
1465 }
1466
1467 // sub callback
1468 {
1469 "gb18030",
1470 "$\x7f\x80\u01f9\u20ac\u4e00\u9fa6\uffff\U00010000\U0010ffff",
1471 :bin{ 247f81308130a8bfa2e3d2bb82358f338431a43990308130e3329a35 },
1472 :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 },
1473 :int{1}, :int{0}, "", "?", ""
1474 }
1475
1476 // skip callback
1477 { "ibm-930", "\u6D63\u6D64\u6D65\u6D66", :bin{ 0e5d5f5d63466b0f }, :intvector{ 0, 0, 0, 1, 1, 3, 3, 3 }, :int{1}, :int{0}, "", "0", "" }
1478 { "ibm-930", "\u6D63\u6D64\ud89a\u6D66", :bin{ 0e5d5f5d63466b0f }, :intvector{ 0, 0, 0, 1, 1, 3, 3, 3 }, :int{1}, :int{0}, "", "0", "" }
1479 { "ibm-930", "\u6D63\u6D64\ud89a\u6D66", :bin{ 0e5d5f5d63 }, :intvector{ 0, 0, 0, 1, 1 }, :int{1}, :int{0}, "illegal", "0i", "\ud89a" }
1480
1481 // sub callback for supplementary code point
1482 { "LATIN1", "1\U000104012", :bin{ 311a32 }, :intvector{ 0, 1, 3 }, :int{1}, :int{0}, "", "", "" }
1483 { "ibm-920", "1\U000104012", :bin{ 311a32 }, :intvector{ 0, 1, 3 }, :int{1}, :int{0}, "", "", "" }
1484
1485 // sub callback with AA as subchar
1486 { "ibm-920", "1\U000104012", :bin{ 31AA32 }, :intvector{ 0, 1, 3 }, :int{1}, :int{0}, "", "?\x00\xAA", "" }
1487
1488 // same but not flushing
1489 { "LATIN1", "1\U000104012", :bin{ 311a32 }, :intvector{ 0, 1, 3 }, :int{0}, :int{0}, "", "", "\U00010401" }
1490 { "ibm-920", "1\U000104012", :bin{ 311a32 }, :intvector{ 0, 1, 3 }, :int{0}, :int{0}, "", "", "\U00010401" }
1491
1492 // simple sample, no error handling
1493 { "UTF-8", "a\U0010FFFF", :bin{ 61F48FBFBF }, :intvector{ 0, 1, 1, 1, 1 }, :int{1}, :int{0}, "", "", "" }
46f4442e
A
1494
1495 // Verify that incomplete surrogates are handled as an error
1496 { "UTF-8", "a\udc00", :bin{ 61efbfbd }, :intvector{ 0, 1, 1, 1 }, :int{1}, :int{0}, "", "", "" }
1497 { "UTF-8", "a\ud800", :bin{ 61efbfbd }, :intvector{ 0, 1, 1, 1 }, :int{1}, :int{0}, "", "", "" }
1498 { "UTF-8", "a\udc00b", :bin{ 61efbfbd62 }, :intvector{ 0, 1, 1, 1, 2 }, :int{1}, :int{0}, "", "", "" }
1499 { "UTF-8", "a\ud800b", :bin{ 61efbfbd62 }, :intvector{ 0, 1, 1, 1, 2 }, :int{1}, :int{0}, "", "", "" }
1500
1501 // Code coverage for the EUC variants.
1502 { "EUC-JP", "\u0061\u4edd\u5bec\ud801\udc01\ud801\u0061\u00a2", :bin{ 61a1b88ff4ae618ee0 }, :intvector{ 0, 1, 1, 2, 2, 2, 6, 7, 7 }, :int{1}, :int{0}, "", "0", "" }
1503 { "EUC-JP", "\u0061\u4edd\u5bec\ud801\udc01\ud801\u0061\u00a2", :bin{ 61a1b88ff4aef4fef4fe618ee0 }, :intvector{ 0, 1, 1, 2, 2, 2, 3, 3, 5, 5, 6, 7, 7 }, :int{1}, :int{0}, "", "", "" }
1504 { "EUC-TW", "\u0061\u2295\u5BF2\ud801\udc01\ud801\u0061\u8706\u008a", :bin{ 61a2d38ea2dce561e6ca8a }, :intvector{ 0, 1, 1, 2, 2, 2, 2, 6, 7, 7, 8 }, :int{1}, :int{0}, "", "0", "" }
1505 { "EUC-TW", "\u0061\u2295\u5BF2\ud801\udc01\ud801\u0061\u8706\u008a", :bin{ 61a2d38ea2dce5fdfefdfe61e6ca8a }, :intvector{ 0, 1, 1, 2, 2, 2, 2, 3, 3, 5, 5, 6, 7, 7, 8 }, :int{1}, :int{0}, "", "", "" }
374ca955
A
1506 }
1507 }
1508
1509 getUnicodeSet {
1510 // charset - will be opened, and ucnv_getUnicodeSet() called on it
1511 // map - set of code points and strings that must be in the returned set
1512 // mapnot - set of code points and strings that must *not* be in the returned set
1513 // which - numeric UConverterUnicodeSet value
1514 Headers { "charset", "map", "mapnot", "which" }
1515 Cases {
73c04bcf
A
1516 // Unicode charsets that do not map surrogate code points
1517 {
1518 "UTF-8",
1519 "[\x00-\ud7ff\ue000-\U0010ffff]",
1520 "[\ud800-\udfff]",
1521 :int{0}
1522 }
1523 {
1524 "UTF-16",
1525 "[\x00-\ud7ff\ue000-\U0010ffff]",
1526 "[\ud800-\udfff]",
1527 :int{0}
1528 }
1529 {
1530 "UTF-16BE",
1531 "[\x00-\ud7ff\ue000-\U0010ffff]",
1532 "[\ud800-\udfff]",
1533 :int{0}
1534 }
1535 {
1536 "UTF-16LE",
1537 "[\x00-\ud7ff\ue000-\U0010ffff]",
1538 "[\ud800-\udfff]",
1539 :int{0}
1540 }
1541 {
1542 "UTF-32",
1543 "[\x00-\ud7ff\ue000-\U0010ffff]",
1544 "[\ud800-\udfff]",
1545 :int{0}
1546 }
1547 {
1548 "UTF-32BE",
1549 "[\x00-\ud7ff\ue000-\U0010ffff]",
1550 "[\ud800-\udfff]",
1551 :int{0}
1552 }
1553 {
1554 "UTF-32LE",
1555 "[\x00-\ud7ff\ue000-\U0010ffff]",
1556 "[\ud800-\udfff]",
1557 :int{0}
1558 }
1559
1560 // Unicode charsets that do map surrogate code points
1561 {
1562 "UTF-7",
1563 "[\x00-\U0010ffff]",
1564 "[]",
1565 :int{0}
1566 }
1567 {
1568 "SCSU",
1569 "[\x00-\U0010ffff]",
1570 "[]",
1571 :int{0}
1572 }
1573 {
1574 "BOCU-1",
1575 "[\x00-\U0010ffff]",
1576 "[]",
1577 :int{0}
1578 }
1579 {
1580 "CESU-8",
1581 "[\x00-\U0010ffff]",
1582 "[]",
1583 :int{0}
1584 }
1585
1586 // versions of ISO-2022-KR
374ca955
A
1587 {
1588 "ISO-2022-KR",
73c04bcf
A
1589 "[\x00-\x0d\x10-\x1a\x1c-\x7f\xa1\xa4\xfe\u0111\u4e00\u4e01\uac00-\uac02\uffe6]",
1590 "[\x0e\x0f\x1b\x80-\xa0\xa3\xa5\xff-\u0110\uac03\uffe7-\U0010ffff]",
1591 :int{0}
1592 }
1593 {
1594 "ibm-25546",
1595 "[\x00-\x0d\x10-\x1a\x1c-\x7f\xa1\xa4\xfe\u0111\u4e00\u4e01\uac00-\uac01\uffe6]",
1596 "[\x0e\x0f\x1b\x80-\xa0\xa3\xa5\xff-\u0110\uac02\uffe7-\U0010ffff]",
374ca955
A
1597 :int{0}
1598 }
1599
1600 // versions of ISO-2022-JP
1601 {
1602 "ISO-2022-JP",
46f4442e
A
1603 "[\x00-\x0d\x10-\x1a\x1c-\x7f\xa5\u0391-\u03a1\u2015\u203e\u4e00\u4e01\uffe5]",
1604 "[\x0e\x0f\x1b\u0100-\u0113\u0385-\u038a\u2014\u301c\u4e02\u4e27-\u4e29\u4fe0\u663b\u9eb5\ufa0e-\ufa2d\uff61-\uff9f\uffe4\uffe6-\U0010ffff]",
374ca955
A
1605 :int{0}
1606 }
1607 {
1608 "ISO-2022-JP-2",
46f4442e
A
1609 "[\x00-\x0d\x10-\x1a\x1c-\x7f\xa0-\u0113\u0384-\u0386\u0388-\u038a\u0390-\u03a1\u203e\u4e00-\u4e05\u4fe0\u663b\uffe6]",
1610 "[\x0e\x0f\x1b\uff61-\uff9f\uffe4\uffe7-\U0010ffff]",
374ca955
A
1611 :int{0}
1612 }
46f4442e
A
1613 {
1614 "JIS7",
1615 "[\x00-\x0d\x10-\x1a\x1c-\x7f\xa0-\u0113\u0384-\u0386\u0388-\u038a\u0390-\u03a1\u203e\u4e00-\u4e05\u4fe0\u663b\uff61-\uff9f\uffe6]",
1616 "[\x0e\x0f\x1b\uffe4\uffe7-\U0010ffff]",
1617 :int{0}
1618 }
1619 // with fallbacks
1620 {
1621 "ISO-2022-JP",
1622 "[\x00-\x0d\x10-\x1a\x1c-\x7f\xa5\u0391-\u03a1\u2014\u2015\u203e\u301c\u4e00\u4e01\u4fe0\u9eb5\uff61-\uff9f\uffe5]",
1623 "[\x0e\x0f\x1b\xa6\u0100-\u0113\u0385-\u038a\u4e02\u4e27-\u4e29\u663b\ufa0e-\ufa2d\uffe4\uffe6-\U0010ffff]",
1624 :int{1}
1625 }
374ca955
A
1626
1627 // versions of ISO-2022-CN
1628 {
1629 "ISO-2022-CN",
73c04bcf
A
1630 "[\x00-\x0d\x10-\x1a\x1c-\x7f\u4e00\u4e01\u9f98\ufe6b]",
1631 "[\x0e\x0f\x1b\u4e29\uffe6-\U0010ffff]",
374ca955
A
1632 :int{0}
1633 }
1634 {
1635 "ISO-2022-CN-EXT",
73c04bcf
A
1636 "[\x00-\x0d\x10-\x1a\x1c-\x7f\u4e00-\u4e05\u9f98\ufe6b\u4e28-\u4e2b\U00020000\U00020003-\U00020005\U00029664]",
1637 "[\x0e\x0f\x1b\U00020001\U00020002\U0002a6d7-\U0010ffff]",
374ca955
A
1638 :int{0}
1639 }
1640
46f4442e
A
1641 // HZ
1642 {
1643 "HZ",
1644 "[\u0410-\u044f\u4e00\u4e01\u4e03]",
1645 "[\u4e02\u4e04-\u4e06\uac00-\ud7ff]",
1646 :int{0}
1647 }
1648
1649 // LMBCS
1650 {
1651 "LMBCS",
1652 "[\x00-\U0010ffff]",
1653 "[]",
1654 :int{0}
1655 }
1656
1657 // ISCII,version=0 (note: all versions of ISCII generates the same Unicodeset)
1658 {
1659 "iscii-dev",
1660 "[\x00-\xa0\u0909-\u0939\u0993-\u09a8\u0a13-\u0a28\u0a93-\u0aa8\u0ae6-\u0aef\u0b05-\u0b0c\u0b13-\u0b28\u0bae-\u0bb5\u0c12-\u0c28\u0c92-\u0ca8\u0d12-\u0d28]",
1661 "[\u0971-\u0975\u09e4\u0a4e-\u0a58\u0a80\u0b72-\u0b7a\u0bfb-\u0bff\u0c70-\u0c7f\u0c80\u0d00]",
1662 :int{0}
1663 }
1664
1665 {
1666 "iso-8859-1",
1667 "[\x00-\xff]",
1668 "[\u0100-\u01ff]",
1669 :int{0}
1670 }
1671
1672 {
1673 "us-ascii",
1674 "[\x00-\x7f]",
1675 "[\u0100-\u01ff]",
1676 :int{0}
1677 }
374ca955
A
1678 // DBCS-only
1679 {
1680 "ibm-971",
1681 "[\xa1\xa4\uac01\ub000]",
1682 "[\x00-\x9f\u2015]",
1683 :int{0}
1684 }
1685
1686 {
1687 "ibm-16684",
1688 "[\xa0\xa1\xa4\xa6-\xab\xad-\u017f\u0254\u309b-\u30ff\u4e00-\u4e05\U00023d00\U000243bc\U0002a6b2"
1689 "{\u0254\u0300}{\u0254\u0301}{\u304b\u309a}{\u30ad\u309a}{\u30af\u309a}]",
1690 "[\x00-0x9f\xa2\xa3\xa5\xac\u0200-\u024f\U00010000-\U0001ffff\U0002a61b-\U0002a6b1]",
1691 :int{0}
1692 }
1693
1694 // extensions
1695 {
1696 "ibm-1390",
1697 "[\x00-\x0d\x10-\u017f\u0254\u309b-\u30ff\u4e00-\u4e05\U00023d00\U000243bc\U0002a6b2"
1698 "{\u0254\u0300}{\u0254\u0301}{\u304b\u309a}{\u30ad\u309a}{\u30af\u309a}]",
1699 "[\x0e\x0f\u0200-\u024f\U00010000-\U0001ffff\U0002a61b-\U0002a6b1]",
1700 :int{0}
1701 }
1702
1703 {
1704 "*test3",
1705 "[\x05\x0b\xc0\u20ac\U00023456\U00101234"
1706 "{\U00101234\U00050005\U00060006}{\U00101234\U00050005}{\U00101234\U00060006}{\xc4\xc4\U00101234\x05}]",
1707 "[\x06\x0e\U00034567\U000febcd{\U00101234\U00070007}]",
1708 :int{0}
1709 }
1710 }
1711 }
1712 }
1713}