Qt-interest Archive, October 2007
qt unicode display problem
Message 1 in thread
Hi list,
I have some unicode text and want to feed it to a textEdit object. When I
ran the gui,
-self.textEdit_2.insertPlainText(my_text)- the result is disappointing, as
text is being presented as "chinese", when characters are not latin ones.
All my attempts to transform it to QString type have failed. Any ideas what
this has to do with?
print QtCore.QString(str(my_text))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 14-23:
ordinal not in range(128)
print QtCore.QString(unicode(my_text))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xce in position 14:
ordinal not in range(128)
print QtCore.QString(my_text)
TypeError: argument 1 of QString() has an invalid type
type(my_text): <class 'web.wikipedia.WikipediaParagraph'>
(which is just unicode text)
Thanks