char *w = "Artîsté";
printf("%lu\n", strlen(w));
int z;
for(z=0; z<strlen(w); z++){
//printf("%c", w[z]); //prints as expected
printf("%i: %c\n", z, w[z]);//doesn't print anything
}
If I run this, it fails at the î
. How do I print a multibyte char and how do I know when a I've hit a multibyte character?
Use the wide char and multi-byte functions:
You got lucky with the first printf, because you never changed the data, once you split up the chars, your output was no longer utf8.