I have simple program.
#include <stdio.h>
#include <string.h
int main(int argc, char *argv[])
{
for (int i = 0; i < strlen(argv[1]); ++i)
printf("%x ", argv[1][i]);
printf("\n");
}
I run it like
$ ./program 111
31 31 31
But when I run it like
$ ./program ●●●
ffffffe2 ffffff97 ffffff8f ffffffe2 ffffff97 ffffff8f ffffffe2 ffffff97 ffffff8f
Here each ●
is should be encoded by 3 bytes (UTF-8): e2
97
8f
, but looks like it is encoded by 3 unsigned
.
I don't understand where the ffffff
comes from if sizeof(char)
is always 1 byte.