[entropy.output] always return unicode data (when possible) out of _my_raw_input(), close bug 2006.

This commit is contained in:
Fabio Erculiani
2010-12-10 12:43:35 +01:00
parent af39de27a6
commit 95d0d9139d

View File

@@ -16,7 +16,8 @@ import sys
import errno
import curses
from entropy.const import etpUi, const_convert_to_rawstring, const_isstring
from entropy.const import etpUi, const_convert_to_rawstring, const_isstring, \
const_convert_to_unicode, const_isunicode
from entropy.i18n import _
stuff = {}
@@ -626,6 +627,15 @@ def _my_raw_input(txt = ''):
break
response += y
_flush_stdouterr()
# try to convert to unicode, because responses are stored that
# way, fix bug #2006.
if not const_isunicode(response):
try:
response = const_convert_to_unicode(response, "utf-8")
except (UnicodeDecodeError, UnicodeEncodeError):
# be fault tolerant, we just tried
pass
return response
class TextInterface: