SuperHannaR
31st July 2012, 12:12
I try to find a way to read an xml file that has utf-16 encoding, apparently QIODevice can’t read utf-16 xml files, it says it’s invalid file.
After searching the internet and the t assistant I found that the only library that can set a codec in a file is QTextStream.
Then I found this: QTextCodec.
After searching a bit more on the internet I understood that I need to create an encoding function by myself that should look like this:
QByteArray myEncoderFunc( const QString &xmlfileNameSt );
And call this function like this:
xmlFile.setEncodingFunction ( myEncoderFunc ) ;
With all this information I don’t really know how do I make my file readable for QXmlStreamReader.
Can you help in this?
Thanks,
Hanna
After searching the internet and the t assistant I found that the only library that can set a codec in a file is QTextStream.
Then I found this: QTextCodec.
After searching a bit more on the internet I understood that I need to create an encoding function by myself that should look like this:
QByteArray myEncoderFunc( const QString &xmlfileNameSt );
And call this function like this:
xmlFile.setEncodingFunction ( myEncoderFunc ) ;
With all this information I don’t really know how do I make my file readable for QXmlStreamReader.
Can you help in this?
Thanks,
Hanna