Created
July 1, 2013 04:48
-
-
Save zed/5898423 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import locale | |
import os | |
import sys | |
envname = "PYTHONIOENCODING" | |
print("{}:\t{}".format(envname, os.environ.get(envname))) | |
for set_locale in [False]: | |
print("locale({}):\t{}".format(set_locale, | |
locale.getpreferredencoding(set_locale))) | |
for streamname in "stdout stderr stdin".split(): | |
stream = getattr(sys, streamname) | |
print("device({}):\t{}".format(streamname, | |
os.device_encoding(stream.fileno()))) | |
print("{}.encoding:\t{}".format(streamname, stream.encoding)) | |
for set_locale in [False, True]: | |
print("locale({}):\t{}".format(set_locale, | |
locale.getpreferredencoding(set_locale))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment