kdialog and unicode

Peter Otten __peter__ at web.de
Tue Apr 26 07:36:05 EDT 2005


Dumbkiwi wrote:

>> Just encode the data in the target encoding before passing it to
>> os.popen():
>> 
>> test = os.popen('kdialog --inputbox %s' % data.encode("utf-8"))
 
> I had tried that, but then the text looks like crap.  The text I'm using
> for this is Polish, and there are a lot of non-English characters in
> there. Using this method results in some strange characters - basically it
> looks like a file encoded in utf-8, but displayed using iso-8859-1.
> 
> Is this the best I can do?

I've just tried the setup you described (with German umlauts instead of
Polish characters) on my Suse 9.1, and it works as expected with both
Python 2.3 and 2.4. Perhaps the target encoding you need is not UTF-8. I
would try other popular encodings used for Polish text (no idea what these
are). sys.stdout.encoding might give you a clue.

Peter



More information about the Python-list mailing list