1
0
mirror of https://github.com/nvbn/thefuck.git synced 2024-10-05 18:31:10 +01:00

#486: Use alternative encoding when sys.stdout.encoding is None

Fix #486
This commit is contained in:
Pablo Santiago Blum de Aguiar 2016-03-22 01:26:56 -03:00
parent f604756cb7
commit 047efd5575

View File

@ -1,3 +1,4 @@
import os
import sys
import msvcrt
import win_unicode_console
@ -22,4 +23,5 @@ def get_key():
if ch == b'P':
return const.KEY_DOWN
return ch.decode(sys.stdout.encoding)
encoding = sys.stdout.encoding or os.environ.get('PYTHONIOENCODING', 'utf-8')
return ch.decode(encoding)