On 04/27/2018 09:56 PM, Carlos Guevara wrote: > Revised radix.c: > ##### > #include <stdio.h> > #include <locale.h> > > int > main(int argc, char ** argv) > { > unsigned char buf[100]; > unsigned int i; > > printf("%s\n", setlocale(LC_ALL, "ar_AE.UTF-8")); > snprintf(buf, sizeof(buf), "%g", 3.2); > > for (i = 0; i < sizeof(buf); i++) { > if (buf[i] == '\0') break; > printf(" %x", buf[i]); > } > printf("\n"); > } > ##### > > Output: > ##### > ar_AE.UTF-8 > 33 d9 32 > ##### > That should instead have been 33 d9 ab 32. And that indicates that the problem is indeed with the OS. My guess is that it doesn't consider the possibility of a multi-byte radix character, so it uses just the first byte, but \xd9 is a start byte of a two byte sequence, so this is leading to malformed UTF-8. I'll submit a trouble ticket for them.Thread Previous | Thread Next