Solved Changing the character set to UTF-8
-
So what I'm trying to do is to read some text from a .txt file and I have letters like č,š,ž so I need the UTF-8 charset but I can't seem to find a way to do it. Here's the code where I'm reading from a file and creating a string. Can someone please help me out.
QString temp_str; QFile file("strategije.txt")); if (file.exists()){ if (file.open(QIODevice::ReadOnly | QIODevice::Text)){ QTextStream txtStream(&file); txtStream.seek(0); temp_str = txtStream.readLine(); if(temp_str=="Situacija"){ temp_str = ""; for(int i=0; i<5; i++){ temp_str += txtStream.readLine(); temp_str += "\n"; } } } else{ qDebug() << "the file is not open"; } } else{ qDebug() << "the file does not exist"; } file.close();
-
-
-
Oh, that was simple. Thank you for the help @CHRISTIAN EHRLICHER, this worked.