[PyKDE] unicode char with PyQt

Tobias Unruh Tobias_Unruh at FRM2.TU-Muenchen.DE
Fri Oct 5 14:25:44 BST 2001


Hi,

I tried to save a text with ASCII char ord(char)>128 (e.g. german ue)
using the application.py example of PyQt 2.5. The result is:

Traceback (most recent call last):
  File "./application.py", line 194, in save
    self.saveAs()
  File "./application.py", line 214, in saveAs
    self.save()
  File "./application.py", line 203, in save
    f.write(str(self.e.text()))
  File "/usr/local/lib/python2.1/site-packages/qt.py", line 320, in
__str__
    return str(self.sipThis)
UnicodeError: ASCII encoding error: ordinal not in range(128)

I have similar problems with my own programs. Can someone tell me how to
convert a QString which contains unicode char to a python string
containing unicode char?

Tobias

--
Tobias Unruh
TU Muenchen, FRM-II
85747 Garching, Germany





More information about the PyQt mailing list