Im trying to read a (UTF-8 formatted) file containing accented chars like 'ů', 'ú' and other ones. I have already managed to print them correcly using 'SetConsoleOutputCP( 65001 )'. My code for the file reading is below:
ifstream myfile(path);
string str;
while (getline (myfile, str))
{
cout << str;
for (char &c : str)
{
stuff_done_with(c);
}
}
Using this method the accented character looks corrupted, using wifstream its showing for example 9{ instead of ů. Thanks for help.
Aucun commentaire:
Enregistrer un commentaire