localedata: Convert day names in nn_NO locale to UTF-8
[glibc.git] / iconv / tst-iconv1.c
blob03fbbe853bb4264e51380941a5528fa4a1239e68
2 #include <iconv.h>
3 #include <stddef.h>
4 #include <stdio.h>
5 #include <string.h>
7 static int
8 do_test (void)
10 char utf8[5];
11 wchar_t ucs4[5];
12 iconv_t cd;
13 char *inbuf;
14 char *outbuf;
15 size_t inbytes;
16 size_t outbytes;
17 size_t n;
19 strcpy (utf8, "abcd");
21 /* From UTF8 to UCS4. */
22 cd = iconv_open ("UCS4", "UTF8");
23 if (cd == (iconv_t) -1)
25 perror ("iconv_open");
26 return 1;
29 inbuf = utf8;
30 inbytes = 4;
31 outbuf = (char *) ucs4;
32 outbytes = 4 * sizeof (wchar_t); /* "Argument list too long" error. */
33 n = iconv (cd, &inbuf, &inbytes, &outbuf, &outbytes);
34 if (n == (size_t) -1)
36 printf ("iconv: %m\n");
37 iconv_close (cd);
38 return 1;
40 iconv_close (cd);
42 return 0;
45 #define TEST_FUNCTION do_test ()
46 #include "../test-skeleton.c"