Skip to content

Instantly share code, notes, and snippets.

@ionelmc
Last active August 29, 2015 14:02
Show Gist options
  • Save ionelmc/176d66872d5fb5475256 to your computer and use it in GitHub Desktop.
Save ionelmc/176d66872d5fb5475256 to your computer and use it in GitHub Desktop.
cmd.exe futzing
C:\Users\ionel_000>chcp 65001
Active code page: 65001
C:\Users\ionel_000>py -3
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:45:13) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.getlocale()
(None, None)
>>> locale.getlocale(locale.LC_ALL)
(None, None)
>>> locale.getpreferredencoding()
'cp1250'
>>> from ctypes import windll
>>> windll.kernel32.SetConsoleOutputCP(65001)
1
>>> windll.kernel32.GetACP()
1250
>>> windll.kernel32.SetConsoleCP(65001)
1
>>> windll.kernel32.GetACP()
1250
>>> locale.getpreferredencoding()
'cp1250'
>>> locale.getlocale(locale.LC_ALL)
(None, None)
>>> locale.getlocale()
(None, None)
>>> locale.setlocale(locale.LC_ALL, ('en_US', 'UTF-8'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python34\lib\locale.py", line 592, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting
>>> locale.setlocale(locale.LC_ALL, ('eng_US', 'UTF-8'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python34\lib\locale.py", line 592, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting
>>> locale.setlocale(locale.LC_ALL, ('eng_US', 'UTF8'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python34\lib\locale.py", line 592, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting
>>> locale.setlocale(locale.LC_ALL, ('eng_US', '65001'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python34\lib\locale.py", line 592, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting
>>> locale.setlocale(locale.LC_ALL, ('eng_US', 'cp65001'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python34\lib\locale.py", line 592, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment