Setting stdout encoding

Fabio Zadrozny fabiofz at gmail.com
Thu Sep 13 07:08:39 EDT 2007


>
> But I don't think it's a good idea. Changing the default encoding will
> change it for *all* scripts, *all* users, *all* objects. And AFAIK you
> have trouble ONLY with sys.std* - one should fix those objects, not mess
> with a global configuration.
>

Makes sense... Do you think that creating a new object, setting it as
sys.stdout and overriding its write() method to check for a unicode string
to do original_stdout.write(unicode_str.encode(my_encoding)) would do it?
(the ctypes version is not really an option as it is not available on lots
of installs -- although I can try to use it if it's available, but it can't
be the only solution).

Thanks,

Fabio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070913/b4bd15b8/attachment.html>


More information about the Python-list mailing list