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

2006-01-26 Thread Ismail Donmez
Per 26 Oca 2006 16:27 tarihinde, Phil Thompson şunları yazmıştı: 
> On Thursday 26 January 2006 1:44 pm, Ismail Donmez wrote:
> > Per 26 Oca 2006 15:35 tarihinde, Phil Thompson şunları yazmıştı:
> > > On Thursday 26 January 2006 1:10 pm, Ismail Donmez wrote:
> > > > Per 26 Oca 2006 11:29 tarihinde, Andreas Pakulat şunları yazmıştı:
> > > > > On 26.01.06 03:15:54, Ismail Donmez wrote:
> > > > > > I am doing something like this QStatusBar.showMessage("Foo - %s"
> > > > > > % QDate.toString(QtCore.Qt.TextDate))
> > > > >
> > > > > Does it work with:
> > > > >
> > > > > QStatusBar.showMessage(QtCore.QString("Foo -
> > > > > %1").arg(QDate.toString(QtCore.Qt.QTextDate)))
> > > >
> > > > This one works fine too, guess there is a problem with %s, Phil can
> > > > you comment on this?
> > >
> > > You are converting Unicode to a string then back to Unicode. PyQt tries
> > > (not very hard) to find a Python codec matching the current Qt codec
> > > and falls back to the default Python codec. This is obviously going
> > > wrong at some point, but I'm not surprised.
> > >
> > > Did you do something similar with PyQt3? Did you try with both 3.15.1
> > > and the current PyQt3 snapshot?
> >
> > Its the same with current PyQt3 snapshot. So I guess it was all like this
> > before too. Thanks you both.
>
> I'd still like to know if it works with PyQt 3.15.1 - there have been
> changes that would affect this since then.
>

Tried with PyQt snapshot from 20051013:

In [1]: from qt import *

In [2]: print "%s" % QString("€uro")
â¬uro



> Phil
>
> ___
> PyKDE mailing listPyKDE@mats.imk.fraunhofer.de
> http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

___
PyKDE mailing listPyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde


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

2006-01-26 Thread Phil Thompson
On Thursday 26 January 2006 1:44 pm, Ismail Donmez wrote:
> Per 26 Oca 2006 15:35 tarihinde, Phil Thompson şunları yazmıştı:
> > On Thursday 26 January 2006 1:10 pm, Ismail Donmez wrote:
> > > Per 26 Oca 2006 11:29 tarihinde, Andreas Pakulat şunları yazmıştı:
> > > > On 26.01.06 03:15:54, Ismail Donmez wrote:
> > > > > I am doing something like this QStatusBar.showMessage("Foo - %s" %
> > > > > QDate.toString(QtCore.Qt.TextDate))
> > > >
> > > > Does it work with:
> > > >
> > > > QStatusBar.showMessage(QtCore.QString("Foo -
> > > > %1").arg(QDate.toString(QtCore.Qt.QTextDate)))
> > >
> > > This one works fine too, guess there is a problem with %s, Phil can you
> > > comment on this?
> >
> > You are converting Unicode to a string then back to Unicode. PyQt tries
> > (not very hard) to find a Python codec matching the current Qt codec and
> > falls back to the default Python codec. This is obviously going wrong at
> > some point, but I'm not surprised.
> >
> > Did you do something similar with PyQt3? Did you try with both 3.15.1 and
> > the current PyQt3 snapshot?
>
> Its the same with current PyQt3 snapshot. So I guess it was all like this
> before too. Thanks you both.

I'd still like to know if it works with PyQt 3.15.1 - there have been changes 
that would affect this since then.

Phil

___
PyKDE mailing listPyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde


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

2006-01-26 Thread Ismail Donmez
Per 26 Oca 2006 15:35 tarihinde, Phil Thompson şunları yazmıştı: 
> On Thursday 26 January 2006 1:10 pm, Ismail Donmez wrote:
> > Per 26 Oca 2006 11:29 tarihinde, Andreas Pakulat şunları yazmıştı:
> > > On 26.01.06 03:15:54, Ismail Donmez wrote:
> > > > I am doing something like this QStatusBar.showMessage("Foo - %s" %
> > > > QDate.toString(QtCore.Qt.TextDate))
> > >
> > > Does it work with:
> > >
> > > QStatusBar.showMessage(QtCore.QString("Foo -
> > > %1").arg(QDate.toString(QtCore.Qt.QTextDate)))
> >
> > This one works fine too, guess there is a problem with %s, Phil can you
> > comment on this?
>
> You are converting Unicode to a string then back to Unicode. PyQt tries
> (not very hard) to find a Python codec matching the current Qt codec and
> falls back to the default Python codec. This is obviously going wrong at
> some point, but I'm not surprised.
>
> Did you do something similar with PyQt3? Did you try with both 3.15.1 and
> the current PyQt3 snapshot?

Its the same with current PyQt3 snapshot. So I guess it was all like this 
before too. Thanks you both.

Regards,
ismail

___
PyKDE mailing listPyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde


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

2006-01-26 Thread Phil Thompson
On Thursday 26 January 2006 1:10 pm, Ismail Donmez wrote:
> Per 26 Oca 2006 11:29 tarihinde, Andreas Pakulat şunları yazmıştı:
> > On 26.01.06 03:15:54, Ismail Donmez wrote:
> > > I am doing something like this QStatusBar.showMessage("Foo - %s" %
> > > QDate.toString(QtCore.Qt.TextDate))
> >
> > Does it work with:
> >
> > QStatusBar.showMessage(QtCore.QString("Foo -
> > %1").arg(QDate.toString(QtCore.Qt.QTextDate)))
>
> This one works fine too, guess there is a problem with %s, Phil can you
> comment on this?

You are converting Unicode to a string then back to Unicode. PyQt tries (not 
very hard) to find a Python codec matching the current Qt codec and falls 
back to the default Python codec. This is obviously going wrong at some 
point, but I'm not surprised.

Did you do something similar with PyQt3? Did you try with both 3.15.1 and the 
current PyQt3 snapshot?

Phil

___
PyKDE mailing listPyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde


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

2006-01-26 Thread Ismail Donmez
Per 26 Oca 2006 11:29 tarihinde, Andreas Pakulat şunları yazmıştı: 
> On 26.01.06 03:15:54, Ismail Donmez wrote:
> > I am doing something like this QStatusBar.showMessage("Foo - %s" %
> > QDate.toString(QtCore.Qt.TextDate))
>
> Does it work with:
>
> QStatusBar.showMessage(QtCore.QString("Foo -
> %1").arg(QDate.toString(QtCore.Qt.QTextDate)))

This one works fine too, guess there is a problem with %s, Phil can you 
comment on this?

Regards,
ismail

___
PyKDE mailing listPyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde


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

2006-01-26 Thread Andreas Pakulat
On 26.01.06 03:15:54, Ismail Donmez wrote:
> I am doing something like this QStatusBar.showMessage("Foo - %s" % 
> QDate.toString(QtCore.Qt.TextDate))

Does it work with:

QStatusBar.showMessage(QtCore.QString("Foo -
%1").arg(QDate.toString(QtCore.Qt.QTextDate)))

? I suspect that the %-replacement converts the QString to str and then
after replacement again into QString and in between you loose
Unicode'ness of your string. But this is only guessing, Phil should know
for sure.

Andreas

-- 
Don't go surfing in South Dakota for a while.

___
PyKDE mailing listPyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde


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

2006-01-26 Thread Phil Thompson
On Thursday 26 January 2006 12:53 am, Ismail Donmez wrote:
> Hi,
>
> 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?

There's nothing special about these methods as far as PyQt is concerned - no 
handwritten code or anything. Can you repeat the problem with an equivalent 
C++ program?

Phil

___
PyKDE mailing listPyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde


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

2006-01-25 Thread Ismail Donmez
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

___
PyKDE mailing listPyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde


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

2006-01-25 Thread Andreas Pakulat
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.

andreas

-- 
Your own qualities will help prevent your advancement in the world.

___
PyKDE mailing listPyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde