From 047efd55750ae76c4e4e0b3322a48c2b7a6a5dac Mon Sep 17 00:00:00 2001 From: Pablo Santiago Blum de Aguiar Date: Tue, 22 Mar 2016 01:26:56 -0300 Subject: [PATCH] #486: Use alternative encoding when sys.stdout.encoding is None Fix #486 --- thefuck/system/win32.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/thefuck/system/win32.py b/thefuck/system/win32.py index b09778e1..a8b6c0a4 100644 --- a/thefuck/system/win32.py +++ b/thefuck/system/win32.py @@ -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) \ No newline at end of file + encoding = sys.stdout.encoding or os.environ.get('PYTHONIOENCODING', 'utf-8') + return ch.decode(encoding)