Hi can’t read the french accent (like ‘é’) in a text file,
this is the piece of code I use to open and read the file…
FILE* file = fopen( [MyFileName UTF8String], "r, ccs=UTF-8");
if (file != 0)
{
while(fgets(buffer, 1024, file) != NULL)
{
NSString* string = [[NSString alloc] initWithCString: buffer];
//Do many things.....
}
fclose(file);
}
I can’t see where is the problem, my file is correctly encoded in UTF8…
Thanks!
Instead of
fopenandfgetsyou can read the content of file in aNSStringby usingstringWithContentsOfFile:usedEncoding:error:method directly.