https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79280
--- Comment #2 from Jan Turoň <janturon at email dot cz> --- setlocale does some change, but still not right: My system locale is cs_CZ, the default codepage is 1250, console uses 852. I Have these results, considering this code: const char *str = "ř"; mbtowc(&(a.w), str, 6); printf("\na = %hhx%hhx", a.bytes.b2, a.bytes.b1); setlocale(LC_CTYPE,"C"); // gives 0c5 setlocale(LC_CTYPE,"Czech_Czech Republic.1250"); // (same as "") gives 139 setlocale(LC_CTYPE,"Czech_Czech Republic.852"); // (same as "") gives 253c The expected result is 159 (Unicode number of "ř").