1 #include <locale.h> 2 #include <stdint.h> 3 #include <stdlib.h> 4 #include <stdio.h> 5 6 int main(void)7main (void) 8 { 9 wchar_t wc; 10 11 if (setlocale (LC_CTYPE, "de_DE.UTF-8") == NULL) 12 { 13 puts ("setlocale failed"); 14 return 1; 15 } 16 17 if (mbtowc (&wc, "\xc3\xa1", MB_CUR_MAX) != 2 || wc != 0xE1) 18 { 19 puts ("1st mbtowc failed"); 20 return 1; 21 } 22 23 if (mbtowc (&wc, "\xc3\xa1", SIZE_MAX) != 2 || wc != 0xE1) 24 { 25 puts ("2nd mbtowc failed"); 26 return 1; 27 } 28 29 return 0; 30 } 31