[Qt-interest] Problesm with utf-8 encoded XML andjapanese characters
Scott Aron Bloom
Scott.Bloom at sabgroup.com
Thu Sep 24 06:17:42 CEST 2009
Thanks for the test case...
Of COURSE it works fine with it.. even with my full XML.. so now I have
to track down to see where its different...
Thanks again (and Girish as well..) its not the font, or the widget..
its actually in a qmenu and shows just fine.. in the test case :(
Scott
-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of Chris W
Sent: Wednesday, September 23, 2009 7:26 PM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] Problesm with utf-8 encoded XML andjapanese
characters
Scott Aron Bloom wrote:
> 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.
I cannot reproduce this (QT 4.5.2 on Linux). I get the Japanese
characters reliably.
* With or without a byte-order-mark in the xml file.
* With text going to a QLabel
* qDebug() output of the string to unicode aware terminal (konsole)
My test harness:
#include <QtGui>
#include <QtXml/QDomDocument>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QMainWindow mainWin;
QLabel *label = new QLabel;
mainWin.setCentralWidget(label);
QDomDocument doc("mydocument");
QFile file("test.xml");
if (file.open(QIODevice::ReadOnly)) {
if (doc.setContent(&file)) {
qDebug() <<
doc.firstChildElement().firstChildElement().text();
label->setText(
doc.firstChildElement().firstChildElement().text()
);
}
file.close();
}
mainWin.show();
return app.exec();
}
Is it possible to build Qt without Unicode support?
Regards,
Chris W
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list