Python 2.7.8:
Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> exec("""
import os, sys, unicodedata
print(sys.platform, sys.version)
print(os.getenv('PYTHONIOENCODING', None))
print(sys.getdefaultencoding())
print(sys.stdin.encoding, sys.stdout.encoding, sys.stderr.encoding)
try:
print(unicodedata.lookup('WHITE CHESS KING'))
except KeyError as e:
print('%s: %s' % (e.__class__.__name__, e))
try:
print( sys.getwindowsversion())
except AttributeError as e:
print('%s: %s' % (e.__class__.__name__, e))
""")
('win32', '2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)]')
None
ascii
('cp1252', 'cp1252', 'cp1252')
♔
sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1')
Python 3.4.1:
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:38:22) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> exec("""
import os, sys, unicodedata
print(sys.platform, sys.version)
print(os.getenv('PYTHONIOENCODING', None))
print(sys.getdefaultencoding())
print(sys.stdin.encoding, sys.stdout.encoding, sys.stderr.encoding)
try:
print(unicodedata.lookup('WHITE CHESS KING'))
except KeyError as e:
print('%s: %s' % (e.__class__.__name__, e))
try:
print( sys.getwindowsversion())
except AttributeError as e:
print('%s: %s' % (e.__class__.__name__, e))
""")
win32 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:38:22) [MSC v.1600 32 bit (Intel)]
None
utf-8
cp1252 cp1252 cp1252
♔
sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1')
(Yes, I am too lazy to save the code as a file and run it properly. Long live interactive Python!)
FYI, the encodings of the std streams aren't guaranteed to always be the same. I ran the code in IDLE, which pretends to use codepage 1252 (wannabe Latin-1) but actually has Unicode support. If I run the code in the normal python interpreter in the cmd shell (which uses Codepage 850 without any Unicode support by default), it fails to print the Unicode character and produces this traceback:
Traceback (most recent call last):
File "<stdin>", line 18, in <module>
File "<string>", line 10, in <module>
File "C:\Python\3.4\lib\encodings\cp850.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2654' in position 0: character maps to <undefined>