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
}
如果我運行它,它會崩潰在「」上。如何打印多字節字符,以及如何知道何時打出多字節字符?如何從utf8字符串中獲取字符
*我怎麼知道什麼時候我碰到了多字節字符?*高位是1. – 2011-12-23 03:31:15
您可能想看看UTF8是什麼:http://en.wikipedia.org/wiki/UTF-8 – 2011-12-23 03:31:47
哪條線會崩潰?什麼平臺? – 2011-12-23 03:33:34