]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
f7faf1f5 | 2 | * "$Id: testi18n.c 5444 2006-04-20 18:16:54Z mike $" |
ef416fc2 | 3 | * |
4 | * Internationalization test for Common UNIX Printing System (CUPS). | |
5 | * | |
e1d6a774 | 6 | * Copyright 1997-2006 by Easy Software Products. |
ef416fc2 | 7 | * |
8 | * These coded instructions, statements, and computer programs are | |
9 | * the property of Easy Software Products and are protected by Federal | |
10 | * copyright law. Distribution and use rights are outlined in the | |
11 | * file "LICENSE.txt" which should have been included with this file. | |
12 | * If this file is missing or damaged please contact Easy Software | |
13 | * Products at: | |
14 | * | |
15 | * Attn: CUPS Licensing Information | |
16 | * Easy Software Products | |
17 | * 44141 Airport View Drive, Suite 204 | |
18 | * Hollywood, Maryland 20636 USA | |
19 | * | |
20 | * Voice: (301) 373-9600 | |
21 | * EMail: cups-info@cups.org | |
22 | * WWW: http://www.cups.org | |
23 | * | |
24 | * Contents: | |
25 | * | |
89d46774 | 26 | * main() - Main entry for internationalization test module. |
27 | * print_utf8() - Print UTF-8 string with (optional) message. | |
ef416fc2 | 28 | */ |
29 | ||
30 | /* | |
31 | * Include necessary headers... | |
32 | */ | |
33 | ||
34 | #include <stdio.h> | |
35 | #include <stdlib.h> | |
36 | #include <errno.h> | |
37 | #include <time.h> | |
89d46774 | 38 | #include <unistd.h> |
ef416fc2 | 39 | |
e1d6a774 | 40 | #include "i18n.h" |
ef416fc2 | 41 | #include "string.h" |
ef416fc2 | 42 | |
43 | ||
44 | /* | |
45 | * Local functions... | |
46 | */ | |
47 | ||
ef416fc2 | 48 | static void print_utf8(const char *msg, const cups_utf8_t *src); |
ef416fc2 | 49 | |
50 | ||
51 | /* | |
52 | * 'main()' - Main entry for internationalization test module. | |
53 | */ | |
54 | ||
55 | int /* O - Exit code */ | |
56 | main(int argc, /* I - Argument Count */ | |
57 | char *argv[]) /* I - Arguments */ | |
ef416fc2 | 58 | { |
59 | FILE *fp; /* File pointer */ | |
60 | int count; /* File line counter */ | |
e1d6a774 | 61 | int status, /* Status of current test */ |
62 | errors; /* Error count */ | |
ef416fc2 | 63 | char line[1024]; /* File line source string */ |
64 | int len; /* Length (count) of string */ | |
e1d6a774 | 65 | char legsrc[1024], /* Legacy source string */ |
66 | legdest[1024], /* Legacy destination string */ | |
67 | *legptr; /* Pointer into legacy string */ | |
ef416fc2 | 68 | cups_utf8_t utf8latin[] = /* UTF-8 Latin-1 source */ |
69 | { 0x41, 0x20, 0x21, 0x3D, 0x20, 0xC3, 0x84, 0x2E, 0x00 }; | |
70 | /* "A != <A WITH DIAERESIS>." - use ISO 8859-1 */ | |
71 | cups_utf8_t utf8repla[] = /* UTF-8 Latin-1 replacement */ | |
72 | { 0x41, 0x20, 0xE2, 0x89, 0xA2, 0x20, 0xC3, 0x84, 0x2E, 0x00 }; | |
73 | /* "A <NOT IDENTICAL TO> <A WITH DIAERESIS>." */ | |
74 | cups_utf8_t utf8greek[] = /* UTF-8 Greek source string */ | |
75 | { 0x41, 0x20, 0x21, 0x3D, 0x20, 0xCE, 0x91, 0x2E, 0x00 }; | |
e1d6a774 | 76 | /* "A != <ALPHA>." - use ISO 8859-7 */ |
ef416fc2 | 77 | cups_utf8_t utf8japan[] = /* UTF-8 Japanese source */ |
78 | { 0x41, 0x20, 0x21, 0x3D, 0x20, 0xEE, 0x9C, 0x80, 0x2E, 0x00 }; | |
79 | /* "A != <PRIVATE U+E700>." - use Windows 932 or EUC-JP */ | |
80 | cups_utf8_t utf8taiwan[] = /* UTF-8 Chinese source */ | |
81 | { 0x41, 0x20, 0x21, 0x3D, 0x20, 0xE4, 0xB9, 0x82, 0x2E, 0x00 }; | |
82 | /* "A != <CJK U+4E42>." - use Windows 950 (Big5) or EUC-TW */ | |
ef416fc2 | 83 | cups_utf8_t utf8dest[1024]; /* UTF-8 destination string */ |
ef416fc2 | 84 | cups_utf32_t utf32dest[1024]; /* UTF-32 destination string */ |
e1d6a774 | 85 | _cups_vmap_t *vmap; /* VBCS charmap pointer */ |
ef416fc2 | 86 | |
87 | ||
89d46774 | 88 | /* |
89 | * Make sure we have a symbolic link from the data directory to a | |
90 | * "charmaps" directory, and then point the library at it... | |
91 | */ | |
92 | ||
93 | if (access("charmaps", 0)) | |
94 | symlink("../data", "charmaps"); | |
95 | ||
96 | putenv("CUPS_DATADIR=."); | |
97 | ||
ef416fc2 | 98 | /* |
e1d6a774 | 99 | * Start with some conversion tests from a UTF-8 test file. |
ef416fc2 | 100 | */ |
101 | ||
e1d6a774 | 102 | errors = 0; |
103 | ||
104 | if ((fp = fopen("utf8demo.txt", "r")) == NULL) | |
ef416fc2 | 105 | { |
e1d6a774 | 106 | perror("utf8demo.txt"); |
107 | return (1); | |
ef416fc2 | 108 | } |
109 | ||
110 | /* | |
e1d6a774 | 111 | * cupsUTF8ToUTF32 |
ef416fc2 | 112 | */ |
113 | ||
e1d6a774 | 114 | fputs("cupsUTF8ToUTF32 of utfdemo.txt: ", stdout); |
115 | ||
116 | for (count = 0, status = 0; fgets(line, sizeof(line), fp);) | |
ef416fc2 | 117 | { |
e1d6a774 | 118 | count ++; |
119 | ||
120 | if (cupsUTF8ToUTF32(utf32dest, (cups_utf8_t *)line, 1024) < 0) | |
121 | { | |
122 | printf("FAIL (UTF-8 to UTF-32 on line %d)\n", count); | |
123 | errors ++; | |
124 | status = 1; | |
125 | break; | |
126 | } | |
ef416fc2 | 127 | } |
128 | ||
e1d6a774 | 129 | if (!status) |
130 | puts("PASS"); | |
ef416fc2 | 131 | |
e1d6a774 | 132 | /* |
133 | * cupsUTF8ToCharset(CUPS_EUC_JP) | |
134 | */ | |
ef416fc2 | 135 | |
e1d6a774 | 136 | fputs("cupsUTF8ToCharset(CUPS_EUC_JP) of utfdemo.txt: ", stdout); |
ef416fc2 | 137 | |
e1d6a774 | 138 | rewind(fp); |
139 | ||
140 | for (count = 0, status = 0; fgets(line, sizeof(line), fp);) | |
141 | { | |
142 | count ++; | |
ef416fc2 | 143 | |
144 | len = cupsUTF8ToCharset(legdest, (cups_utf8_t *)line, 1024, CUPS_EUC_JP); | |
145 | if (len < 0) | |
e1d6a774 | 146 | { |
147 | printf("FAIL (UTF-8 to EUC-JP on line %d)\n", count); | |
148 | errors ++; | |
149 | status = 1; | |
150 | break; | |
151 | } | |
ef416fc2 | 152 | } |
153 | ||
e1d6a774 | 154 | if (!status) |
155 | puts("PASS"); | |
156 | ||
ef416fc2 | 157 | fclose(fp); |
158 | ||
e1d6a774 | 159 | /* |
160 | * Test charmap load for ISO-8859-1... | |
161 | */ | |
162 | ||
163 | fputs("_cupsCharmapGet(CUPS_ISO8859_1): ", stdout); | |
164 | ||
165 | if (!_cupsCharmapGet(CUPS_ISO8859_1)) | |
166 | { | |
167 | errors ++; | |
168 | puts("FAIL"); | |
169 | } | |
170 | else | |
171 | puts("PASS"); | |
ef416fc2 | 172 | |
173 | /* | |
e1d6a774 | 174 | * Test charmap load for Windows-932 (Shift-JIS)... |
ef416fc2 | 175 | */ |
176 | ||
e1d6a774 | 177 | fputs("_cupsCharmapGet(CUPS_WINDOWS_932): ", stdout); |
ef416fc2 | 178 | |
e1d6a774 | 179 | if (!_cupsCharmapGet(CUPS_WINDOWS_932)) |
180 | { | |
181 | errors ++; | |
182 | puts("FAIL"); | |
183 | } | |
184 | else | |
185 | puts("PASS"); | |
ef416fc2 | 186 | |
e1d6a774 | 187 | /* |
188 | * Test VBCS charmap load for EUC-JP... | |
189 | */ | |
190 | ||
191 | fputs("_cupsCharmapGet(CUPS_EUC_JP): ", stdout); | |
192 | ||
193 | if ((vmap = (_cups_vmap_t *)_cupsCharmapGet(CUPS_EUC_JP)) == NULL) | |
ef416fc2 | 194 | { |
e1d6a774 | 195 | errors ++; |
196 | puts("FAIL"); | |
ef416fc2 | 197 | } |
e1d6a774 | 198 | else |
199 | puts("PASS"); | |
ef416fc2 | 200 | |
201 | /* | |
202 | * Test VBCS charmap load for EUC-TW... | |
203 | */ | |
204 | ||
e1d6a774 | 205 | fputs("_cupsCharmapGet(CUPS_EUC_TW): ", stdout); |
ef416fc2 | 206 | |
e1d6a774 | 207 | if ((vmap = (_cups_vmap_t *)_cupsCharmapGet(CUPS_EUC_TW)) == NULL) |
ef416fc2 | 208 | { |
e1d6a774 | 209 | errors ++; |
210 | puts("FAIL"); | |
ef416fc2 | 211 | } |
e1d6a774 | 212 | else |
213 | puts("PASS"); | |
ef416fc2 | 214 | |
215 | /* | |
216 | * Test UTF-8 to legacy charset (ISO 8859-1)... | |
217 | */ | |
218 | ||
e1d6a774 | 219 | fputs("cupsUTF8ToCharset(CUPS_ISO8859_1): ", stdout); |
ef416fc2 | 220 | |
221 | legdest[0] = 0; | |
222 | ||
223 | len = cupsUTF8ToCharset(legdest, utf8latin, 1024, CUPS_ISO8859_1); | |
224 | if (len < 0) | |
ef416fc2 | 225 | { |
e1d6a774 | 226 | printf("FAIL (len=%d)\n", len); |
227 | errors ++; | |
ef416fc2 | 228 | } |
e1d6a774 | 229 | else |
230 | puts("PASS"); | |
ef416fc2 | 231 | |
e1d6a774 | 232 | /* |
233 | * cupsCharsetToUTF8 | |
234 | */ | |
ef416fc2 | 235 | |
e1d6a774 | 236 | fputs("cupsCharsetToUTF8(CUPS_ISO8859_1): ", stdout); |
ef416fc2 | 237 | |
e1d6a774 | 238 | strcpy(legsrc, legdest); |
ef416fc2 | 239 | |
e1d6a774 | 240 | len = cupsCharsetToUTF8(utf8dest, legsrc, 1024, CUPS_ISO8859_1); |
241 | if (len != strlen((char *)utf8latin)) | |
242 | { | |
89d46774 | 243 | printf("FAIL (len=%d, expected %d)\n", len, (int)strlen((char *)utf8latin)); |
e1d6a774 | 244 | print_utf8(" utf8latin", utf8latin); |
245 | print_utf8(" utf8dest", utf8dest); | |
246 | errors ++; | |
247 | } | |
248 | else if (memcmp(utf8latin, utf8dest, len)) | |
ef416fc2 | 249 | { |
e1d6a774 | 250 | puts("FAIL (results do not match)"); |
251 | print_utf8(" utf8latin", utf8latin); | |
252 | print_utf8(" utf8dest", utf8dest); | |
253 | errors ++; | |
ef416fc2 | 254 | } |
e1d6a774 | 255 | else if (cupsUTF8ToCharset(legdest, utf8repla, 1024, CUPS_ISO8859_1) < 0) |
256 | { | |
257 | puts("FAIL (replacement characters do not work!)"); | |
258 | errors ++; | |
259 | } | |
260 | else | |
261 | puts("PASS"); | |
ef416fc2 | 262 | |
263 | /* | |
e1d6a774 | 264 | * Test UTF-8 to/from legacy charset (ISO 8859-7)... |
ef416fc2 | 265 | */ |
e1d6a774 | 266 | |
267 | fputs("cupsUTF8ToCharset(CUPS_ISO8859_7): ", stdout); | |
268 | ||
269 | if (cupsUTF8ToCharset(legdest, utf8greek, 1024, CUPS_ISO8859_7) < 0) | |
ef416fc2 | 270 | { |
e1d6a774 | 271 | puts("FAIL"); |
272 | errors ++; | |
ef416fc2 | 273 | } |
e1d6a774 | 274 | else |
275 | { | |
276 | for (legptr = legdest; *legptr && *legptr != '?'; legptr ++); | |
277 | ||
278 | if (*legptr) | |
279 | { | |
280 | puts("FAIL (unknown character)"); | |
281 | errors ++; | |
282 | } | |
283 | else | |
284 | puts("PASS"); | |
285 | } | |
286 | ||
287 | fputs("cupsCharsetToUTF8(CUPS_ISO8859_7): ", stdout); | |
288 | ||
ef416fc2 | 289 | strcpy(legsrc, legdest); |
e1d6a774 | 290 | |
ef416fc2 | 291 | len = cupsCharsetToUTF8(utf8dest, legsrc, 1024, CUPS_ISO8859_7); |
e1d6a774 | 292 | if (len != strlen((char *)utf8greek)) |
293 | { | |
89d46774 | 294 | printf("FAIL (len=%d, expected %d)\n", len, (int)strlen((char *)utf8greek)); |
e1d6a774 | 295 | print_utf8(" utf8greek", utf8greek); |
296 | print_utf8(" utf8dest", utf8dest); | |
297 | errors ++; | |
298 | } | |
299 | else if (memcmp(utf8greek, utf8dest, len)) | |
300 | { | |
301 | puts("FAIL (results do not match)"); | |
302 | print_utf8(" utf8greek", utf8greek); | |
303 | print_utf8(" utf8dest", utf8dest); | |
304 | errors ++; | |
305 | } | |
306 | else | |
307 | puts("PASS"); | |
ef416fc2 | 308 | |
309 | /* | |
e1d6a774 | 310 | * Test UTF-8 to/from legacy charset (Windows 932)... |
ef416fc2 | 311 | */ |
e1d6a774 | 312 | |
313 | fputs("cupsUTF8ToCharset(CUPS_WINDOWS_932): ", stdout); | |
314 | ||
315 | if (cupsUTF8ToCharset(legdest, utf8japan, 1024, CUPS_WINDOWS_932) < 0) | |
ef416fc2 | 316 | { |
e1d6a774 | 317 | puts("FAIL"); |
318 | errors ++; | |
ef416fc2 | 319 | } |
e1d6a774 | 320 | else |
321 | { | |
322 | for (legptr = legdest; *legptr && *legptr != '?'; legptr ++); | |
323 | ||
324 | if (*legptr) | |
325 | { | |
326 | puts("FAIL (unknown character)"); | |
327 | errors ++; | |
328 | } | |
329 | else | |
330 | puts("PASS"); | |
331 | } | |
332 | ||
333 | fputs("cupsCharsetToUTF8(CUPS_WINDOWS_932): ", stdout); | |
334 | ||
ef416fc2 | 335 | strcpy(legsrc, legdest); |
e1d6a774 | 336 | |
ef416fc2 | 337 | len = cupsCharsetToUTF8(utf8dest, legsrc, 1024, CUPS_WINDOWS_932); |
e1d6a774 | 338 | if (len != strlen((char *)utf8japan)) |
339 | { | |
89d46774 | 340 | printf("FAIL (len=%d, expected %d)\n", len, (int)strlen((char *)utf8japan)); |
e1d6a774 | 341 | print_utf8(" utf8japan", utf8japan); |
342 | print_utf8(" utf8dest", utf8dest); | |
343 | errors ++; | |
344 | } | |
345 | else if (memcmp(utf8japan, utf8dest, len)) | |
346 | { | |
347 | puts("FAIL (results do not match)"); | |
348 | print_utf8(" utf8japan", utf8japan); | |
349 | print_utf8(" utf8dest", utf8dest); | |
350 | errors ++; | |
351 | } | |
352 | else | |
353 | puts("PASS"); | |
ef416fc2 | 354 | |
355 | /* | |
e1d6a774 | 356 | * Test UTF-8 to/from legacy charset (EUC-JP)... |
ef416fc2 | 357 | */ |
e1d6a774 | 358 | |
359 | fputs("cupsUTF8ToCharset(CUPS_EUC_JP): ", stdout); | |
360 | ||
361 | if (cupsUTF8ToCharset(legdest, utf8japan, 1024, CUPS_EUC_JP) < 0) | |
ef416fc2 | 362 | { |
e1d6a774 | 363 | puts("FAIL"); |
364 | errors ++; | |
ef416fc2 | 365 | } |
e1d6a774 | 366 | else |
367 | { | |
368 | for (legptr = legdest; *legptr && *legptr != '?'; legptr ++); | |
369 | ||
370 | if (*legptr) | |
371 | { | |
372 | puts("FAIL (unknown character)"); | |
373 | errors ++; | |
374 | } | |
375 | else | |
376 | puts("PASS"); | |
377 | } | |
378 | ||
379 | fputs("cupsCharsetToUTF8(CUPS_EUC_JP): ", stdout); | |
380 | ||
ef416fc2 | 381 | strcpy(legsrc, legdest); |
e1d6a774 | 382 | |
ef416fc2 | 383 | len = cupsCharsetToUTF8(utf8dest, legsrc, 1024, CUPS_EUC_JP); |
e1d6a774 | 384 | if (len != strlen((char *)utf8japan)) |
385 | { | |
89d46774 | 386 | printf("FAIL (len=%d, expected %d)\n", len, (int)strlen((char *)utf8japan)); |
e1d6a774 | 387 | print_utf8(" utf8japan", utf8japan); |
388 | print_utf8(" utf8dest", utf8dest); | |
389 | errors ++; | |
390 | } | |
391 | else if (memcmp(utf8japan, utf8dest, len)) | |
392 | { | |
393 | puts("FAIL (results do not match)"); | |
394 | print_utf8(" utf8japan", utf8japan); | |
395 | print_utf8(" utf8dest", utf8dest); | |
396 | errors ++; | |
397 | } | |
398 | else | |
399 | puts("PASS"); | |
ef416fc2 | 400 | |
401 | /* | |
e1d6a774 | 402 | * Test UTF-8 to/from legacy charset (Windows 950)... |
ef416fc2 | 403 | */ |
e1d6a774 | 404 | |
405 | fputs("cupsUTF8ToCharset(CUPS_WINDOWS_950): ", stdout); | |
406 | ||
407 | if (cupsUTF8ToCharset(legdest, utf8taiwan, 1024, CUPS_WINDOWS_950) < 0) | |
408 | { | |
409 | puts("FAIL"); | |
410 | errors ++; | |
411 | } | |
412 | else | |
ef416fc2 | 413 | { |
e1d6a774 | 414 | for (legptr = legdest; *legptr && *legptr != '?'; legptr ++); |
415 | ||
416 | if (*legptr) | |
417 | { | |
418 | puts("FAIL (unknown character)"); | |
419 | errors ++; | |
420 | } | |
421 | else | |
422 | puts("PASS"); | |
ef416fc2 | 423 | } |
e1d6a774 | 424 | |
425 | fputs("cupsCharsetToUTF8(CUPS_WINDOWS_950): ", stdout); | |
426 | ||
ef416fc2 | 427 | strcpy(legsrc, legdest); |
e1d6a774 | 428 | |
ef416fc2 | 429 | len = cupsCharsetToUTF8(utf8dest, legsrc, 1024, CUPS_WINDOWS_950); |
e1d6a774 | 430 | if (len != strlen((char *)utf8taiwan)) |
431 | { | |
89d46774 | 432 | printf("FAIL (len=%d, expected %d)\n", len, (int)strlen((char *)utf8taiwan)); |
e1d6a774 | 433 | print_utf8(" utf8taiwan", utf8taiwan); |
434 | print_utf8(" utf8dest", utf8dest); | |
435 | errors ++; | |
436 | } | |
437 | else if (memcmp(utf8taiwan, utf8dest, len)) | |
438 | { | |
439 | puts("FAIL (results do not match)"); | |
440 | print_utf8(" utf8taiwan", utf8taiwan); | |
441 | print_utf8(" utf8dest", utf8dest); | |
442 | errors ++; | |
443 | } | |
444 | else | |
445 | puts("PASS"); | |
ef416fc2 | 446 | |
447 | /* | |
e1d6a774 | 448 | * Test UTF-8 to/from legacy charset (EUC-TW)... |
ef416fc2 | 449 | */ |
e1d6a774 | 450 | |
451 | fputs("cupsUTF8ToCharset(CUPS_EUC_TW): ", stdout); | |
452 | ||
453 | if (cupsUTF8ToCharset(legdest, utf8taiwan, 1024, CUPS_EUC_TW) < 0) | |
454 | { | |
455 | puts("FAIL"); | |
456 | errors ++; | |
457 | } | |
458 | else | |
ef416fc2 | 459 | { |
e1d6a774 | 460 | for (legptr = legdest; *legptr && *legptr != '?'; legptr ++); |
461 | ||
462 | if (*legptr) | |
463 | { | |
464 | puts("FAIL (unknown character)"); | |
465 | errors ++; | |
466 | } | |
467 | else | |
468 | puts("PASS"); | |
ef416fc2 | 469 | } |
e1d6a774 | 470 | |
471 | fputs("cupsCharsetToUTF8(CUPS_EUC_TW): ", stdout); | |
472 | ||
ef416fc2 | 473 | strcpy(legsrc, legdest); |
e1d6a774 | 474 | |
ef416fc2 | 475 | len = cupsCharsetToUTF8(utf8dest, legsrc, 1024, CUPS_EUC_TW); |
e1d6a774 | 476 | if (len != strlen((char *)utf8taiwan)) |
477 | { | |
89d46774 | 478 | printf("FAIL (len=%d, expected %d)\n", len, (int)strlen((char *)utf8taiwan)); |
e1d6a774 | 479 | print_utf8(" utf8taiwan", utf8taiwan); |
480 | print_utf8(" utf8dest", utf8dest); | |
481 | errors ++; | |
482 | } | |
483 | else if (memcmp(utf8taiwan, utf8dest, len)) | |
484 | { | |
485 | puts("FAIL (results do not match)"); | |
486 | print_utf8(" utf8taiwan", utf8taiwan); | |
487 | print_utf8(" utf8dest", utf8dest); | |
488 | errors ++; | |
489 | } | |
490 | else | |
491 | puts("PASS"); | |
ef416fc2 | 492 | |
e1d6a774 | 493 | #if 0 |
ef416fc2 | 494 | /* |
495 | * Test UTF-8 (16-bit) to UTF-32 (w/ BOM)... | |
496 | */ | |
497 | if (verbose) | |
498 | printf("\ntesti18n: Testing UTF-8 to UTF-32 (w/ BOM)...\n"); | |
499 | len = cupsUTF8ToUTF32(utf32dest, utf8good, 1024); | |
500 | if (len < 0) | |
501 | return (1); | |
502 | if (verbose) | |
503 | { | |
504 | print_utf8(" utf8good ", utf8good); | |
505 | print_utf32(" utf32dest", utf32dest); | |
506 | } | |
507 | memcpy (utf32src, utf32dest, (len + 1) * sizeof(cups_utf32_t)); | |
508 | len = cupsUTF32ToUTF8(utf8dest, utf32src, 1024); | |
509 | if (len < 0) | |
510 | return (1); | |
511 | if (len != strlen ((char *) utf8good)) | |
512 | return (1); | |
513 | if (memcmp(utf8good, utf8dest, len) != 0) | |
514 | return (1); | |
515 | ||
516 | /* | |
517 | * Test invalid UTF-8 (16-bit) to UTF-32 (w/ BOM)... | |
518 | */ | |
519 | if (verbose) | |
520 | printf("\ntesti18n: Testing UTF-8 bad 16-bit source string...\n"); | |
521 | len = cupsUTF8ToUTF32(utf32dest, utf8bad, 1024); | |
522 | if (len >= 0) | |
523 | return (1); | |
524 | if (verbose) | |
525 | print_utf8(" utf8bad ", utf8bad); | |
526 | ||
527 | /* | |
e1d6a774 | 528 | * Test _cupsCharmapFlush()... |
ef416fc2 | 529 | */ |
530 | if (verbose) | |
e1d6a774 | 531 | printf("\ntesti18n: Testing _cupsCharmapFlush()...\n"); |
532 | _cupsCharmapFlush(); | |
ef416fc2 | 533 | return (0); |
e1d6a774 | 534 | #endif /* 0 */ |
535 | ||
536 | return (errors > 0); | |
ef416fc2 | 537 | } |
538 | ||
539 | ||
540 | /* | |
e1d6a774 | 541 | * 'print_utf8()' - Print UTF-8 string with (optional) message. |
ef416fc2 | 542 | */ |
543 | ||
e1d6a774 | 544 | static void |
545 | print_utf8(const char *msg, /* I - Message String */ | |
546 | const cups_utf8_t *src) /* I - UTF-8 Source String */ | |
ef416fc2 | 547 | { |
e1d6a774 | 548 | if (msg) |
549 | printf("%s:", msg); | |
ef416fc2 | 550 | |
e1d6a774 | 551 | for (; *src; src ++) |
552 | printf(" %02x", *src); | |
ef416fc2 | 553 | |
e1d6a774 | 554 | putchar('\n'); |
555 | } | |
ef416fc2 | 556 | |
ef416fc2 | 557 | |
e1d6a774 | 558 | /* |
f7faf1f5 | 559 | * End of "$Id: testi18n.c 5444 2006-04-20 18:16:54Z mike $" |
ef416fc2 | 560 | */ |