How does Python get the value for sys.stdin.encoding?
rNOSPAMon at flownet.com
Thu Aug 12 03:21:43 CEST 2010
I thought it was hard-coded into the Python executable at compile time,
but that is apparently not the case:
[ron at mickey:~]$ python
Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys;print sys.stdin.encoding
[ron at mickey:~]$ echo 'import sys;print sys.stdin.encoding' | python
[ron at mickey:~]$
And indeed, trying to pipe unicode into Python doesn't work, even though
it works fine when Python runs interactively. So how can I make this
More information about the Python-list