Message235202
Without setting any environment variables:
>>> import sys
>>> sys.getfilesystemencoding()
'utf-8'
>>> import locale
>>> locale.getpreferredencoding(False)
'US-ASCII'
>>> import os
>>> os.popen('cat', 'w').encoding
'US-ASCII'
If I set PYTHONIOENCODING=UTF-8:
>>> import sys, locale, os
>>> sys.getfilesystemencoding()
'utf-8'
>>> locale.getpreferredencoding(False)
'US-ASCII'
>>> os.popen('cat', 'w').encoding
'US-ASCII'
If I set LANG=en_US.utf8:
>>> import sys, locale, os
>>> sys.getfilesystemencoding()
'utf-8'
>>> locale.getpreferredencoding(False)
'US-ASCII'
>>> os.popen('cat', 'w').encoding
'US-ASCII'
It appears neither of these environment variables does much in my environment.
I should point out that I just updated to Mac OS X 10.10.2 a couple
days ago. I have no idea if this problem existed before that upgrade.
Realizing that perhaps something had changed in the underlying
operating system support, I rebuilt Python 2.6 through 3.5 from
scratch. Same result. |
|
Date |
User |
Action |
Args |
2015-02-01 20:15:41 | skip.montanaro | set | recipients:
+ skip.montanaro, serhiy.storchaka |
2015-02-01 20:15:41 | skip.montanaro | link | issue23374 messages |
2015-02-01 20:15:41 | skip.montanaro | create | |
|