fix: use a _in_encoding(): instead _out_encoding():

This commit is contained in:
Guilherme Danno 2016-04-22 20:18:02 -03:00
parent 172498fd33
commit f18fe05e15

View file

@ -71,6 +71,15 @@ class UserError(Exception):
# Encoding utilities.
def _in_encoding():
"""Get the encoding to use for *inputting* strings to the console.
"""
try:
return sys.stdin.encoding or 'utf-8'
except LookupError:
# TODO: create user config
return 'utf-8'
def _out_encoding():
"""Get the encoding to use for *outputting* strings to the console.
@ -193,7 +202,7 @@ def input_(prompt=None):
except EOFError:
raise UserError(u'stdin stream ended while input required')
return resp.decode(_out_encoding(), 'ignore')
return resp.decode(_in_encoding(), 'ignore')
def input_options(options, require=False, prompt=None, fallback_prompt=None,