John Machin wrote: > On 26 Apr 2005 13:39:26 -0700, [EMAIL PROTECTED] (dumbkiwi) wrote: > > >Peter Otten <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > >> Dumbkiwi wrote: > >> > >> >> Just encode the data in the target encoding before passing it to > >> >> os.popen(): > > > > >Anyway, from your post, I've done some more digging, and found the > >command: > > > >sys.setappdefaultencoding() > > > >which I've used, and it's fixed the problem (I think). > > > > Dumb Kiwi, eh? Maybe not so dumb -- where'd you find > sys.setappdefaultencoding()? I'm just a dumb Aussie [1]; I looked in > the 2.4.1 docs and also did import sys; dir(sys) and I can't spot it.
Hmmm. See post above, seems to be something generated by eric3. So this may not be the fix I'm looking for. > > In any case, how could the magical sys.setappdefaultencoding() fix > your problem? From your description, your problem appeared to be that > you didn't know what encoding to use. I knew what encoding to use, the problem was that the text was being passed to kdialog as ascii. The .encode('utf-8') at least allows kdialog to run, but the text still looks like crap. Using sys.setappdefaultencoding() seemed to help. The text looked a bit better - although not entirely perfect - but I think that's because the font I was using didn't have the correct characters (they came up as square boxes). > > What is the essential difference between > > send(u_data.encode('polish')) > > and > > sys.setappdefaultencoding('polish') > ... > send(u_data) Not sure - I'm new to character encoding, and most of this seems like black magic to me. > > [1]: Now that's *TWO* contenders for TautologyOTW :-) > > Cheers, > > John Matt -- http://mail.python.org/mailman/listinfo/python-list