10 setlocale (LC_ALL, "de_DE.UTF-8");
12 iconv_t cd = iconv_open ("ISO-2022-JP//TRANSLIT", "");
13 if (cd == (iconv_t) -1)
15 puts ("iconv_open failed");
19 char instr1[] = "\xc2\xa3\xe2\x82\xac\n";
20 const char expstr1[] = "\033$B!r\033(BEUR\n";
22 size_t inlen = sizeof (instr1);
23 size_t outlen = sizeof (outstr);
25 char *outptr = outstr;
26 size_t r = iconv (cd, &inptr, &inlen, &outptr, &outlen);
29 || outlen != sizeof (outstr) - sizeof (expstr1)
30 || memcmp (outstr, expstr1, sizeof (expstr1)) != 0)
32 puts ("wrong first conversion");
36 char instr2[] = "\xe3\x88\xb1\n";
37 const char expstr2[] = "(\033$B3t\033(B)\n";
38 inlen = sizeof (instr2);
39 outlen = sizeof (outstr);
42 r = iconv (cd, &inptr, &inlen, &outptr, &outlen);
45 || outlen != sizeof (outstr) - sizeof (expstr2)
46 || memcmp (outstr, expstr2, sizeof (expstr2)) != 0)
48 puts ("wrong second conversion");
52 if (iconv_close (cd) != 0)
54 puts ("iconv_close failed");
60 #define TEST_FUNCTION do_test ()
61 #include "../test-skeleton.c"