[PATCH] Use Unicode in the TUI buffer strings (#1015620)
David Shea
dshea at redhat.com
Mon Oct 7 17:36:21 UTC 2013
If there is an error decoding the string as utf-8, raise an exception
containing the failing string in the message.
---
pyanaconda/ui/tui/simpleline/base.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/pyanaconda/ui/tui/simpleline/base.py b/pyanaconda/ui/tui/simpleline/base.py
index 8c2424b..a9b1438 100644
--- a/pyanaconda/ui/tui/simpleline/base.py
+++ b/pyanaconda/ui/tui/simpleline/base.py
@@ -729,6 +729,12 @@ class Widget(object):
if not text:
return
+ try:
+ text = text.decode("utf-8")
+ except UnicodeDecodeError as e:
+ raise ValueError("Unable to decode string %s" %
+ str(e.object).decode("utf-8", "replace"))
+
if row is None:
row = self._cursor[0]
--
1.8.3.1
More information about the anaconda-patches
mailing list