I tried to use QTextStream to read data from xml file,but at last I got empty string. Here is my code:
QFile f("note.xml");
if(f.open(QIODevice::ReadWrite)){
QTextStream in(&f);
in.setCodec("UTF-8");
qDebug()<<in.readAll();
}else qDebug()<<"failed";
Here is the content of xml file:
<?xml version="1.0" encoding="UTF-8" ?>
<note>
<to>George</to>
</note>
I am using Qt_version 5.1.1 and MinGW_32bit-Debug, Windows 7.If I change xml file to txt file,the result is still empty string.