]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
d09495fa | 2 | * "$Id: testi18n.c 5838 2006-08-17 14:41:42Z 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 */ |
ef416fc2 | 85 | |
86 | ||
89d46774 | 87 | /* |
88 | * Make sure we have a symbolic link from the data directory to a | |
89 | * "charmaps" directory, and then point the library at it... | |
90 | */ | |
91 | ||
92 | if (access("charmaps", 0)) | |
93 | symlink("../data", "charmaps"); | |
94 | ||
95 | putenv("CUPS_DATADIR=."); | |
96 | ||
ef416fc2 | 97 | /* |
e1d6a774 | 98 | * Start with some conversion tests from a UTF-8 test file. |
ef416fc2 | 99 | */ |
100 | ||
e1d6a774 | 101 | errors = 0; |
102 | ||
103 | if ((fp = fopen("utf8demo.txt", "r")) == NULL) | |
ef416fc2 | 104 | { |
e1d6a774 | 105 | perror("utf8demo.txt"); |
106 | return (1); | |
ef416fc2 | 107 | } |
108 | ||
109 | /* | |
e1d6a774 | 110 | * cupsUTF8ToUTF32 |
ef416fc2 | 111 | */ |
112 | ||
e1d6a774 | 113 | fputs("cupsUTF8ToUTF32 of utfdemo.txt: ", stdout); |
114 | ||
115 | for (count = 0, status = 0; fgets(line, sizeof(line), fp);) | |
ef416fc2 | 116 | { |
e1d6a774 | 117 | count ++; |
118 | ||
119 | if (cupsUTF8ToUTF32(utf32dest, (cups_utf8_t *)line, 1024) < 0) | |
120 | { | |
121 | printf("FAIL (UTF-8 to UTF-32 on line %d)\n", count); | |
122 | errors ++; | |
123 | status = 1; | |
124 | break; | |
125 | } | |
ef416fc2 | 126 | } |
127 | ||
e1d6a774 | 128 | if (!status) |
129 | puts("PASS"); | |
ef416fc2 | 130 | |
e1d6a774 | 131 | /* |
132 | * cupsUTF8ToCharset(CUPS_EUC_JP) | |
133 | */ | |
ef416fc2 | 134 | |
e1d6a774 | 135 | fputs("cupsUTF8ToCharset(CUPS_EUC_JP) of utfdemo.txt: ", stdout); |
ef416fc2 | 136 | |
e1d6a774 | 137 | rewind(fp); |
138 | ||
139 | for (count = 0, status = 0; fgets(line, sizeof(line), fp);) | |
140 | { | |
141 | count ++; | |
ef416fc2 | 142 | |
143 | len = cupsUTF8ToCharset(legdest, (cups_utf8_t *)line, 1024, CUPS_EUC_JP); | |
144 | if (len < 0) | |
e1d6a774 | 145 | { |
146 | printf("FAIL (UTF-8 to EUC-JP on line %d)\n", count); | |
147 | errors ++; | |
148 | status = 1; | |
149 | break; | |
150 | } | |
ef416fc2 | 151 | } |
152 | ||
e1d6a774 | 153 | if (!status) |
154 | puts("PASS"); | |
155 | ||
ef416fc2 | 156 | fclose(fp); |
157 | ||
e1d6a774 | 158 | /* |
159 | * Test charmap load for ISO-8859-1... | |
160 | */ | |
161 | ||
162 | fputs("_cupsCharmapGet(CUPS_ISO8859_1): ", stdout); | |
163 | ||
164 | if (!_cupsCharmapGet(CUPS_ISO8859_1)) | |
165 | { | |
166 | errors ++; | |
167 | puts("FAIL"); | |
168 | } | |
169 | else | |
170 | puts("PASS"); | |
ef416fc2 | 171 | |
172 | /* | |
e1d6a774 | 173 | * Test charmap load for Windows-932 (Shift-JIS)... |
ef416fc2 | 174 | */ |
175 | ||
e1d6a774 | 176 | fputs("_cupsCharmapGet(CUPS_WINDOWS_932): ", stdout); |
ef416fc2 | 177 | |
e1d6a774 | 178 | if (!_cupsCharmapGet(CUPS_WINDOWS_932)) |
179 | { | |
180 | errors ++; | |
181 | puts("FAIL"); | |
182 | } | |
183 | else | |
184 | puts("PASS"); | |
ef416fc2 | 185 | |
e1d6a774 | 186 | /* |
187 | * Test VBCS charmap load for EUC-JP... | |
188 | */ | |
189 | ||
190 | fputs("_cupsCharmapGet(CUPS_EUC_JP): ", stdout); | |
191 | ||
d09495fa | 192 | if (!_cupsCharmapGet(CUPS_EUC_JP)) |
ef416fc2 | 193 | { |
e1d6a774 | 194 | errors ++; |
195 | puts("FAIL"); | |
ef416fc2 | 196 | } |
e1d6a774 | 197 | else |
198 | puts("PASS"); | |
ef416fc2 | 199 | |
200 | /* | |
201 | * Test VBCS charmap load for EUC-TW... | |
202 | */ | |
203 | ||
e1d6a774 | 204 | fputs("_cupsCharmapGet(CUPS_EUC_TW): ", stdout); |
ef416fc2 | 205 | |
d09495fa | 206 | if (!_cupsCharmapGet(CUPS_EUC_TW)) |
ef416fc2 | 207 | { |
e1d6a774 | 208 | errors ++; |
209 | puts("FAIL"); | |
ef416fc2 | 210 | } |
e1d6a774 | 211 | else |
212 | puts("PASS"); | |
ef416fc2 | 213 | |
214 | /* | |
215 | * Test UTF-8 to legacy charset (ISO 8859-1)... | |
216 | */ | |
217 | ||
e1d6a774 | 218 | fputs("cupsUTF8ToCharset(CUPS_ISO8859_1): ", stdout); |
ef416fc2 | 219 | |
220 | legdest[0] = 0; | |
221 | ||
222 | len = cupsUTF8ToCharset(legdest, utf8latin, 1024, CUPS_ISO8859_1); | |
223 | if (len < 0) | |
ef416fc2 | 224 | { |
e1d6a774 | 225 | printf("FAIL (len=%d)\n", len); |
226 | errors ++; | |
ef416fc2 | 227 | } |
e1d6a774 | 228 | else |
229 | puts("PASS"); | |
ef416fc2 | 230 | |
e1d6a774 | 231 | /* |
232 | * cupsCharsetToUTF8 | |
233 | */ | |
ef416fc2 | 234 | |
e1d6a774 | 235 | fputs("cupsCharsetToUTF8(CUPS_ISO8859_1): ", stdout); |
ef416fc2 | 236 | |
e1d6a774 | 237 | strcpy(legsrc, legdest); |
ef416fc2 | 238 | |
e1d6a774 | 239 | len = cupsCharsetToUTF8(utf8dest, legsrc, 1024, CUPS_ISO8859_1); |
240 | if (len != strlen((char *)utf8latin)) | |
241 | { | |
89d46774 | 242 | printf("FAIL (len=%d, expected %d)\n", len, (int)strlen((char *)utf8latin)); |
e1d6a774 | 243 | print_utf8(" utf8latin", utf8latin); |
244 | print_utf8(" utf8dest", utf8dest); | |
245 | errors ++; | |
246 | } | |
247 | else if (memcmp(utf8latin, utf8dest, len)) | |
ef416fc2 | 248 | { |
e1d6a774 | 249 | puts("FAIL (results do not match)"); |
250 | print_utf8(" utf8latin", utf8latin); | |
251 | print_utf8(" utf8dest", utf8dest); | |
252 | errors ++; | |
ef416fc2 | 253 | } |
e1d6a774 | 254 | else if (cupsUTF8ToCharset(legdest, utf8repla, 1024, CUPS_ISO8859_1) < 0) |
255 | { | |
256 | puts("FAIL (replacement characters do not work!)"); | |
257 | errors ++; | |
258 | } | |
259 | else | |
260 | puts("PASS"); | |
ef416fc2 | 261 | |
262 | /* | |
e1d6a774 | 263 | * Test UTF-8 to/from legacy charset (ISO 8859-7)... |
ef416fc2 | 264 | */ |
e1d6a774 | 265 | |
266 | fputs("cupsUTF8ToCharset(CUPS_ISO8859_7): ", stdout); | |
267 | ||
268 | if (cupsUTF8ToCharset(legdest, utf8greek, 1024, CUPS_ISO8859_7) < 0) | |
ef416fc2 | 269 | { |
e1d6a774 | 270 | puts("FAIL"); |
271 | errors ++; | |
ef416fc2 | 272 | } |
e1d6a774 | 273 | else |
274 | { | |
275 | for (legptr = legdest; *legptr && *legptr != '?'; legptr ++); | |
276 | ||
277 | if (*legptr) | |
278 | { | |
279 | puts("FAIL (unknown character)"); | |
280 | errors ++; | |
281 | } | |
282 | else | |
283 | puts("PASS"); | |
284 | } | |
285 | ||
286 | fputs("cupsCharsetToUTF8(CUPS_ISO8859_7): ", stdout); | |
287 | ||
ef416fc2 | 288 | strcpy(legsrc, legdest); |
e1d6a774 | 289 | |
ef416fc2 | 290 | len = cupsCharsetToUTF8(utf8dest, legsrc, 1024, CUPS_ISO8859_7); |
e1d6a774 | 291 | if (len != strlen((char *)utf8greek)) |
292 | { | |
89d46774 | 293 | printf("FAIL (len=%d, expected %d)\n", len, (int)strlen((char *)utf8greek)); |
e1d6a774 | 294 | print_utf8(" utf8greek", utf8greek); |
295 | print_utf8(" utf8dest", utf8dest); | |
296 | errors ++; | |
297 | } | |
298 | else if (memcmp(utf8greek, utf8dest, len)) | |
299 | { | |
300 | puts("FAIL (results do not match)"); | |
301 | print_utf8(" utf8greek", utf8greek); | |
302 | print_utf8(" utf8dest", utf8dest); | |
303 | errors ++; | |
304 | } | |
305 | else | |
306 | puts("PASS"); | |
ef416fc2 | 307 | |
308 | /* | |
e1d6a774 | 309 | * Test UTF-8 to/from legacy charset (Windows 932)... |
ef416fc2 | 310 | */ |
e1d6a774 | 311 | |
312 | fputs("cupsUTF8ToCharset(CUPS_WINDOWS_932): ", stdout); | |
313 | ||
314 | if (cupsUTF8ToCharset(legdest, utf8japan, 1024, CUPS_WINDOWS_932) < 0) | |
ef416fc2 | 315 | { |
e1d6a774 | 316 | puts("FAIL"); |
317 | errors ++; | |
ef416fc2 | 318 | } |
e1d6a774 | 319 | else |
320 | { | |
321 | for (legptr = legdest; *legptr && *legptr != '?'; legptr ++); | |
322 | ||
323 | if (*legptr) | |
324 | { | |
325 | puts("FAIL (unknown character)"); | |
326 | errors ++; | |
327 | } | |
328 | else | |
329 | puts("PASS"); | |
330 | } | |
331 | ||
332 | fputs("cupsCharsetToUTF8(CUPS_WINDOWS_932): ", stdout); | |
333 | ||
ef416fc2 | 334 | strcpy(legsrc, legdest); |
e1d6a774 | 335 | |
ef416fc2 | 336 | len = cupsCharsetToUTF8(utf8dest, legsrc, 1024, CUPS_WINDOWS_932); |
e1d6a774 | 337 | if (len != strlen((char *)utf8japan)) |
338 | { | |
89d46774 | 339 | printf("FAIL (len=%d, expected %d)\n", len, (int)strlen((char *)utf8japan)); |
e1d6a774 | 340 | print_utf8(" utf8japan", utf8japan); |
341 | print_utf8(" utf8dest", utf8dest); | |
342 | errors ++; | |
343 | } | |
344 | else if (memcmp(utf8japan, utf8dest, len)) | |
345 | { | |
346 | puts("FAIL (results do not match)"); | |
347 | print_utf8(" utf8japan", utf8japan); | |
348 | print_utf8(" utf8dest", utf8dest); | |
349 | errors ++; | |
350 | } | |
351 | else | |
352 | puts("PASS"); | |
ef416fc2 | 353 | |
354 | /* | |
e1d6a774 | 355 | * Test UTF-8 to/from legacy charset (EUC-JP)... |
ef416fc2 | 356 | */ |
e1d6a774 | 357 | |
358 | fputs("cupsUTF8ToCharset(CUPS_EUC_JP): ", stdout); | |
359 | ||
360 | if (cupsUTF8ToCharset(legdest, utf8japan, 1024, CUPS_EUC_JP) < 0) | |
ef416fc2 | 361 | { |
e1d6a774 | 362 | puts("FAIL"); |
363 | errors ++; | |
ef416fc2 | 364 | } |
e1d6a774 | 365 | else |
366 | { | |
367 | for (legptr = legdest; *legptr && *legptr != '?'; legptr ++); | |
368 | ||
369 | if (*legptr) | |
370 | { | |
371 | puts("FAIL (unknown character)"); | |
372 | errors ++; | |
373 | } | |
374 | else | |
375 | puts("PASS"); | |
376 | } | |
377 | ||
378 | fputs("cupsCharsetToUTF8(CUPS_EUC_JP): ", stdout); | |
379 | ||
ef416fc2 | 380 | strcpy(legsrc, legdest); |
e1d6a774 | 381 | |
ef416fc2 | 382 | len = cupsCharsetToUTF8(utf8dest, legsrc, 1024, CUPS_EUC_JP); |
e1d6a774 | 383 | if (len != strlen((char *)utf8japan)) |
384 | { | |
89d46774 | 385 | printf("FAIL (len=%d, expected %d)\n", len, (int)strlen((char *)utf8japan)); |
e1d6a774 | 386 | print_utf8(" utf8japan", utf8japan); |
387 | print_utf8(" utf8dest", utf8dest); | |
388 | errors ++; | |
389 | } | |
390 | else if (memcmp(utf8japan, utf8dest, len)) | |
391 | { | |
392 | puts("FAIL (results do not match)"); | |
393 | print_utf8(" utf8japan", utf8japan); | |
394 | print_utf8(" utf8dest", utf8dest); | |
395 | errors ++; | |
396 | } | |
397 | else | |
398 | puts("PASS"); | |
ef416fc2 | 399 | |
400 | /* | |
e1d6a774 | 401 | * Test UTF-8 to/from legacy charset (Windows 950)... |
ef416fc2 | 402 | */ |
e1d6a774 | 403 | |
404 | fputs("cupsUTF8ToCharset(CUPS_WINDOWS_950): ", stdout); | |
405 | ||
406 | if (cupsUTF8ToCharset(legdest, utf8taiwan, 1024, CUPS_WINDOWS_950) < 0) | |
407 | { | |
408 | puts("FAIL"); | |
409 | errors ++; | |
410 | } | |
411 | else | |
ef416fc2 | 412 | { |
e1d6a774 | 413 | for (legptr = legdest; *legptr && *legptr != '?'; legptr ++); |
414 | ||
415 | if (*legptr) | |
416 | { | |
417 | puts("FAIL (unknown character)"); | |
418 | errors ++; | |
419 | } | |
420 | else | |
421 | puts("PASS"); | |
ef416fc2 | 422 | } |
e1d6a774 | 423 | |
424 | fputs("cupsCharsetToUTF8(CUPS_WINDOWS_950): ", stdout); | |
425 | ||
ef416fc2 | 426 | strcpy(legsrc, legdest); |
e1d6a774 | 427 | |
ef416fc2 | 428 | len = cupsCharsetToUTF8(utf8dest, legsrc, 1024, CUPS_WINDOWS_950); |
e1d6a774 | 429 | if (len != strlen((char *)utf8taiwan)) |
430 | { | |
89d46774 | 431 | printf("FAIL (len=%d, expected %d)\n", len, (int)strlen((char *)utf8taiwan)); |
e1d6a774 | 432 | print_utf8(" utf8taiwan", utf8taiwan); |
433 | print_utf8(" utf8dest", utf8dest); | |
434 | errors ++; | |
435 | } | |
436 | else if (memcmp(utf8taiwan, utf8dest, len)) | |
437 | { | |
438 | puts("FAIL (results do not match)"); | |
439 | print_utf8(" utf8taiwan", utf8taiwan); | |
440 | print_utf8(" utf8dest", utf8dest); | |
441 | errors ++; | |
442 | } | |
443 | else | |
444 | puts("PASS"); | |
ef416fc2 | 445 | |
446 | /* | |
e1d6a774 | 447 | * Test UTF-8 to/from legacy charset (EUC-TW)... |
ef416fc2 | 448 | */ |
e1d6a774 | 449 | |
450 | fputs("cupsUTF8ToCharset(CUPS_EUC_TW): ", stdout); | |
451 | ||
452 | if (cupsUTF8ToCharset(legdest, utf8taiwan, 1024, CUPS_EUC_TW) < 0) | |
453 | { | |
454 | puts("FAIL"); | |
455 | errors ++; | |
456 | } | |
457 | else | |
ef416fc2 | 458 | { |
e1d6a774 | 459 | for (legptr = legdest; *legptr && *legptr != '?'; legptr ++); |
460 | ||
461 | if (*legptr) | |
462 | { | |
463 | puts("FAIL (unknown character)"); | |
464 | errors ++; | |
465 | } | |
466 | else | |
467 | puts("PASS"); | |
ef416fc2 | 468 | } |
e1d6a774 | 469 | |
470 | fputs("cupsCharsetToUTF8(CUPS_EUC_TW): ", stdout); | |
471 | ||
ef416fc2 | 472 | strcpy(legsrc, legdest); |
e1d6a774 | 473 | |
ef416fc2 | 474 | len = cupsCharsetToUTF8(utf8dest, legsrc, 1024, CUPS_EUC_TW); |
e1d6a774 | 475 | if (len != strlen((char *)utf8taiwan)) |
476 | { | |
89d46774 | 477 | printf("FAIL (len=%d, expected %d)\n", len, (int)strlen((char *)utf8taiwan)); |
e1d6a774 | 478 | print_utf8(" utf8taiwan", utf8taiwan); |
479 | print_utf8(" utf8dest", utf8dest); | |
480 | errors ++; | |
481 | } | |
482 | else if (memcmp(utf8taiwan, utf8dest, len)) | |
483 | { | |
484 | puts("FAIL (results do not match)"); | |
485 | print_utf8(" utf8taiwan", utf8taiwan); | |
486 | print_utf8(" utf8dest", utf8dest); | |
487 | errors ++; | |
488 | } | |
489 | else | |
490 | puts("PASS"); | |
ef416fc2 | 491 | |
e1d6a774 | 492 | #if 0 |
ef416fc2 | 493 | /* |
494 | * Test UTF-8 (16-bit) to UTF-32 (w/ BOM)... | |
495 | */ | |
496 | if (verbose) | |
497 | printf("\ntesti18n: Testing UTF-8 to UTF-32 (w/ BOM)...\n"); | |
498 | len = cupsUTF8ToUTF32(utf32dest, utf8good, 1024); | |
499 | if (len < 0) | |
500 | return (1); | |
501 | if (verbose) | |
502 | { | |
503 | print_utf8(" utf8good ", utf8good); | |
504 | print_utf32(" utf32dest", utf32dest); | |
505 | } | |
506 | memcpy (utf32src, utf32dest, (len + 1) * sizeof(cups_utf32_t)); | |
507 | len = cupsUTF32ToUTF8(utf8dest, utf32src, 1024); | |
508 | if (len < 0) | |
509 | return (1); | |
510 | if (len != strlen ((char *) utf8good)) | |
511 | return (1); | |
512 | if (memcmp(utf8good, utf8dest, len) != 0) | |
513 | return (1); | |
514 | ||
515 | /* | |
516 | * Test invalid UTF-8 (16-bit) to UTF-32 (w/ BOM)... | |
517 | */ | |
518 | if (verbose) | |
519 | printf("\ntesti18n: Testing UTF-8 bad 16-bit source string...\n"); | |
520 | len = cupsUTF8ToUTF32(utf32dest, utf8bad, 1024); | |
521 | if (len >= 0) | |
522 | return (1); | |
523 | if (verbose) | |
524 | print_utf8(" utf8bad ", utf8bad); | |
525 | ||
526 | /* | |
e1d6a774 | 527 | * Test _cupsCharmapFlush()... |
ef416fc2 | 528 | */ |
529 | if (verbose) | |
e1d6a774 | 530 | printf("\ntesti18n: Testing _cupsCharmapFlush()...\n"); |
531 | _cupsCharmapFlush(); | |
ef416fc2 | 532 | return (0); |
e1d6a774 | 533 | #endif /* 0 */ |
534 | ||
535 | return (errors > 0); | |
ef416fc2 | 536 | } |
537 | ||
538 | ||
539 | /* | |
e1d6a774 | 540 | * 'print_utf8()' - Print UTF-8 string with (optional) message. |
ef416fc2 | 541 | */ |
542 | ||
e1d6a774 | 543 | static void |
544 | print_utf8(const char *msg, /* I - Message String */ | |
545 | const cups_utf8_t *src) /* I - UTF-8 Source String */ | |
ef416fc2 | 546 | { |
e1d6a774 | 547 | if (msg) |
548 | printf("%s:", msg); | |
ef416fc2 | 549 | |
e1d6a774 | 550 | for (; *src; src ++) |
551 | printf(" %02x", *src); | |
ef416fc2 | 552 | |
e1d6a774 | 553 | putchar('\n'); |
554 | } | |
ef416fc2 | 555 | |
ef416fc2 | 556 | |
e1d6a774 | 557 | /* |
d09495fa | 558 | * End of "$Id: testi18n.c 5838 2006-08-17 14:41:42Z mike $" |
ef416fc2 | 559 | */ |