F
felix.leg
Hi,
I wrote a simple code to test unicode reading in C:
The file "characters" contains a list of characters from different
Unicode blocks, each divided by a space. The first block contains
characters vaild in both ASCII and Unicode.
But the output is just:
a ,b ,c ,d ,e ,f ,: ,; ,' ," ,[ ,] ,{ ,} , ,
(it looks like the #1 line wasn't executed too)
It stops after fgetwc reach the first non-ASCII character from file.
I thought this function was *supposed to* read them...WTF?
I wrote a simple code to test unicode reading in C:
Code:
#include <stdlib.h>
#include <stdio.h>
#include <wctype.h>
int main (int argc, char *argv[])
{
FILE* f;
wint_t chrk;
f = fopen("characters","r");
while( (chrk = fgetwc(f)) != WEOF ) {
wprintf(L"%C ,", chrk );
}
printf("\b.\n"); //#1
fclose(f);
return 0;
}
The file "characters" contains a list of characters from different
Unicode blocks, each divided by a space. The first block contains
characters vaild in both ASCII and Unicode.
But the output is just:
a ,b ,c ,d ,e ,f ,: ,; ,' ," ,[ ,] ,{ ,} , ,
(it looks like the #1 line wasn't executed too)
It stops after fgetwc reach the first non-ASCII character from file.
I thought this function was *supposed to* read them...WTF?