[Python-ideas] changing sys.stdout encoding

Stephen J. Turnbull stephen at xemacs.org
Wed Jun 6 10:39:22 CEST 2012

Rurpy writes:

 > But even if not, I'm sorry, compared with running a single 
 > command with an encoding option, I think messing with 
 > environment variables is not really a workable solution.  

You have a workable 2-line solution, which you posted.  It's ugly and
hard to find, and it should be, to discourage people from thinking
it's something they might *want* to do.  But they shouldn't; people in
multilingual environments should be using UTF-8 externally unless they
have really really special needs (and even then they should probably
be using UTF-8 embedded in markup that serves those needs).

 > This is really case of the Python tail wagging the application dog.

If you need to do it often, just make a function out of it.  It
doesn't need to be a built-in.

More information about the Python-ideas mailing list