I am reading an html file. The file basically contains Unicode texts as follows:
akko- sati (ā + kruś), akkhāti (ā + k
You read a binary file into QString but do not tell the program, which bytes correspond to which unicode character, i.e. you don't specify the "encoding" aka. "codec".
To debug your problem, ask QTextStream
which codes it uses by default:
QTextStream textStream1(&file);
qDebug() << textStream1.codec()->name();
On my Linux system, that is already "UTF-8" but it might be different on your system. To force QTextStream interpreting the input as UTF-8, use QTextStream::setCodec.