[Qt-interest] Problesm with utf-8 encoded XML and japanese characters
Scott Aron Bloom
Scott.Bloom at sabgroup.com
Wed Sep 23 09:09:55 CEST 2009
I read in the attached test.xml (which is UTF-8 encoded, and contains
Japanese characters)
When I load the XML into a proper editor, the Japanese characters are
plain as day.
However, I need to thread the XML in, so I use QDomDocument
QFile inFile( fileName );
if ( !inFile.open( QIODevice::ReadOnly ) )
{
return;
}
QString errorMsg;
int line, column;
if ( !doc.setContent( &inFile, &errorMsg, &line,
&column ) )
{
return;
}
Where filename is the filename of the path... It loads fine, and there
are no errors on the setContent.
However,
When I get the QString for the value in question (for the simplified
XML)
QString tmp = doc.firstChildElement().firstChildElement().text();
The japansese characters have been replaced with the ascii
representation of the text, not the unicode.
What can I do to avoid this? What am I doing wrong?
Scott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090923/22299926/attachment.html
More information about the Qt-interest-old
mailing list