I can't print some characters due to encoding (I guess), using C

142 views Asked by At

I have to read a txt file (using pure C language) that have some characters like "ã, é, í, ç, ê" and I cant. Already tried to use setlocale(LC_ALL, ""); My pc locale is portuguese_brazil.1252 so it was suppose to work. When I use the setlocale and then I do printf("á, ã, ê, ç"); it works, but what I have to print comes from a txt file (utf-8 encoded). I guess that the "fread" is not getting the characters correctly... What should I do. Sorry if the question is bad asked, i'ts my first one, and my english isn't perfect.

I'm using Windows and Codeblocks.
I tried to use "pt_BR.utf8" "pt_BR.utf-8" and other stuff I found online.. I really thing the error is in the fread. How can I tell the fread to convert the UTF8 to my output?

0

There are 0 answers