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