[PyKDE] a little (big) problem with .ui - pyuic and unicode support :-(

Daniel R.C. danielrc at prosystems-ibiza.com
Thu May 23 13:15:00 BST 2002


Hello, -I'm not really good in english ... sorry- but I need some help,
please.

I explain my problem -and my not really good solution-, I hope somebody help
me :-)

I'm working with pyqt3.4.x + python2.2 + QtNC2.3 under win32 -but, this is
not a win32 problem-

I'm making a little NC aplication for french people. You know ... "ç é è ê"
I need a lot of not ASCII-7 symbols.

When I convert .ui into a .py .... the result like that:
**** .ui *****
    <property>
        <name>caption</name>
        <string>Gestion d''elèves</string>
    </property>
************

*****.py****
 self.setProperty('caption',QVariant(self.tr(QString.fromUtf8("Gestion
d''elèves"))))
***********

Ok. I know ... I need apply unicode() method to QString but ...

self.setProperty('caption',QVariant(self.tr(unicode(QString.fromUtf8("Gestio
n d''elèves")))))

don't work!! :-( ... I got a "UnicodeError: ASCII encoding error: ordinal
not in range(128)"

but ... when I try:

self.setProperty('caption',QVariant(self.tr(unicode(QString.fromLatin1("Gest
ion d'élèves")))))
all work rigth.

I know a bug in IDLE ... and the problem is another ... I don't use IDLE to
edit python code.
The problem with tr() in qt2.x ... and it's not a problem ... I don't have
any multilingual requeriment

The problem is I need use Latin1 and I need an script to "translate" every
è into a è ... and the same with all other simbols because the Utf8 don't
works fine :-(

I get the same problem when I read a text() or other text propierty .. I
need a complicated use of unicode.(Qstring).decode('latin1') ... or
unicode.(QString).encode('latin1') ...

Finally I get de result ok ... but I think you know a best way for work with
qt2.3.x in french or others languages.

You know? Somebody can share with me your own solution for this problem?

Thank you very much,
Daniel Rodriguez.

PS: Please send me a copy of reponse to me private mail :-)
danielrc at prosystems-ibiza.com I'm not suscribed to the list.
PSS: I read the mailing-archives, and I ask google for 1 week and I read the
How To Ask Questions The Smart Way ...




More information about the PyQt mailing list