R. David Murray added the comment:

If you pipe the ls (eg: ls >temp) the bytes are preserved.  Since setting the 
escape handler via PYTHONIOENCODING sets it for both stdin in and stdout, it 
sounds like that solves the sysadmin use case.  The sysadmin can just put that 
environment variable setting in their default profile, and python will once 
again work like the other unix shell tools.  (I double checked, and this does 
indeed work...doing the equivalent of ls >temp via python preserves the bytes 
with that PYTHONIOENCODING setting.  I don't quite understand, however, why I 
get the � chars if I don't redirect the output.). 

I'd be inclined to consider the above as reason enough to close this issue.  As 
usual with Python, explicit is better than implicit.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18713>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to