Program works great, except under less, cron or execl (Unicode?)

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Wed Sep 24 12:36:44 CEST 2008


In message
<c89b7723-50c4-432f-a1e8-7f62f1232ece at v16g2000prc.googlegroups.com>, Sam
wrote:

> So how can I set sys.stdout.encoding so it's UTF-8 when piped through
> cat (or anything else).
> 
> I tried assigning to it, but no dice.

You could try wrapping it in a file object that does explicit encoding
translation, using codecs.EncodedFile
<http://docs.python.org/lib/module-codecs.html>.



More information about the Python-list mailing list