1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-02-22 12:58:33 +00:00

Merge pull request #487 from scorphus/stdout-encoding-none

#486: Use alternative encoding when sys.stdout.encoding is None
This commit is contained in:
Vladimir Iakovlev 2016-03-23 05:09:36 +02:00
commit b1f10642fa

View File

@ -1,3 +1,4 @@
import os
import sys import sys
import msvcrt import msvcrt
import win_unicode_console import win_unicode_console
@ -22,4 +23,5 @@ def get_key():
if ch == b'P': if ch == b'P':
return const.KEY_DOWN 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)