QDomDocument & Encoding
-
Hello,
i have a strange behavior... i have a XML File which is saved in ANSI but it has the <?xml ... encoding="utf-8">.
In this XML there are special characters like ü (\xf6, 246).I could live with it if i get the Byte Value... but the QDomDocument setContent with QFile gets only unusable Bytes.
How can i fix these wrong special characters? Its basically a Ansi File... should i overwrite it beforehand?
Reading with QT as ANSI... fixing all issues and writing again? But you dont know if this is a ANSI File or not. Is there a way to check the Encoding for a File? It feels weird to do that.@ QDomDocument doc("mydocument");
QFile file(xmlfile);
if (!file.open(QIODevice::ReadOnly))
return NULL;if (!doc.setContent(&file)) { file.close(); return NULL; } file.close();@