[Python-ideas] changing sys.stdout encoding

Rurpy rurpy at yahoo.com
Thu Jun 7 23:02:13 CEST 2012


On 06/07/2012 12:27 AM, Paul Moore wrote: 
> One suggestion, which would probably shed some light on whether this
> should be viewed as something "simple and reasonable", would be to do
> some research on how the same task would be achieved in other
> languages.

Yes, that is a good idea.  If I decide to reraise this
suggestion at some point, I will try to do as you suggest.

> I have no experience to contribute but my intuition says
> that this could well be hard on other languages too. 

Again, I have yet to be convinced this is hard.  I am
very sceptical it is hard in the case of streams before
they've been written or read.  Replacing sys.stdout 
with a wrapper that encodes with the alternate encoding
clearly works -- it just needs to be encapsulated so the 
user doesn't need to figure out all the details in order
to use it.

> Would you be
> willing to do some web searches to look for solutions in (say) Java,
> or C#, or Ruby? In theory, it shouldn't take long (as otherwise you
> can conclude that the solution is obscure to the same extent that it
> is with Python).
> 
> Even better, if those other languages do have a simple solution, it
> may suggest an approach that would be appropriate for Python.





More information about the Python-ideas mailing list