I have a string that may or may not contain Unicode characters in it, I'm trying to write this to a file on windows. Below I posted a sample code, my problem is that when I open and read the values back from the windows, they are all interpreted as UTF-16 characters.
char* x = "Fool";
FILE* outFile = fopen( "Serialize.pef", "w+,ccs=UTF-8");
fwrite(x,strlen(x),1,outFile);
fclose(outFile);
char buffer[12];
buffer[11]=NULL;
outFile = fopen( "Serialize.pef", "r,ccs=UTF-8");
fread(buffer,1,12,outFile);
fclose(outFile);
Characters are also interpreted as UTF-16 if I open the file in a text box, etc. What am I doing wrong?
source
share