[PyKDE] [PyQt4] QDate.toString(QtCore.Qt.TextDate) is not UTF-8

Ismail Donmez ismail at uludag.org.tr
Thu Jan 26 01:15:54 GMT 2006


Per 26 Oca 2006 03:11 tarihinde, Andreas Pakulat şunları yazmıştı: 
> On 26.01.06 02:53:31, Ismail Donmez wrote:
> > I am using QDate.toString(QtCore.Qt.TextDate) in my application and
> > Turkish characters are malformed unless I do
> > unicode(QDate.toString(QtCore.Qt.TextDate) , I checked the Qt4 apidocs
> > and it says :
> >
> > QString toString ( const QString & format ) const
> > QString toString ( Qt::DateFormat format = Qt::TextDate ) const
> >
> > so it should already be supporting UTF-8, is there a problem with PyQt4
> > or am I missing something here?
>
> How do you use the resulting QString? Small Test in a python interpreter
> shows that a Qstring with non-ascii characters is always converted via
> unicode() to a python unicode string when that is needed. Also note that
> QString has a toUtf8() method.

I am doing something like this QStatusBar.showMessage("Foo - %s" % 
QDate.toString(QtCore.Qt.TextDate))

I know about toUtf8() method but with PyQt3 unicode always worked 
out-of-the-box for me with QString.

Regards,
ismail




More information about the PyQt mailing list