1 | #include <errno.h>
|
---|
2 | #include <locale.h>
|
---|
3 | #include <stdio.h>
|
---|
4 | #include <string.h>
|
---|
5 | int
|
---|
6 | main ()
|
---|
7 | {
|
---|
8 | const char input[] = "B\303\266se B\303\274bchen"; /* "Böse Bübchen" */
|
---|
9 |
|
---|
10 | setlocale (LC_ALL, "de_DE.UTF-8");
|
---|
11 |
|
---|
12 | char tmpbuf[4000];
|
---|
13 | errno = 0;
|
---|
14 | size_t ret = strxfrm (tmpbuf, input, sizeof (tmpbuf));
|
---|
15 | printf ("result has %u bytes.\n", (unsigned int) ret);
|
---|
16 | unsigned int i;
|
---|
17 | for (i = 0; i <= ret; i++) {
|
---|
18 | printf("result[%u] = 0x%02X\n", i, (unsigned char) tmpbuf[i]);
|
---|
19 | }
|
---|
20 | return 0;
|
---|
21 | }
|
---|