[initial-setup][PATCH] Read licence files as utf-8 encoded (#1023052)

Vratislav Podzimek vpodzime at redhat.com
Wed Oct 30 16:09:13 UTC 2013


License files contain translated licenses so they are usually not ascii.

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 initial_setup/tui/spokes/eula.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/initial_setup/tui/spokes/eula.py b/initial_setup/tui/spokes/eula.py
index 3db2029..ae2080a 100644
--- a/initial_setup/tui/spokes/eula.py
+++ b/initial_setup/tui/spokes/eula.py
@@ -1,6 +1,7 @@
 """EULA TUI spoke for the Initial Setup"""
 
 import gettext
+import codecs
 
 from pyanaconda.ui.tui.spokes import NormalTUISpoke
 from pyanaconda.ui.tui.simpleline.widgets import TextWidget, CheckboxWidget
@@ -100,8 +101,10 @@ class LicenseScreen(UIScreen):
         # read the license file and make it one long string so that it can be
         # processed by the TextWidget to fit in the screen in a best possible
         # way
-        with open(self._license_file, "r") as fobj:
-            buf = u"".join(fobj.xreadlines())
+        buf = u""
+        with codecs.open(self._license_file, "r", "utf-8", "ignore") as fobj:
+            for line in fobj:
+                buf += line
 
         self._window += [TextWidget(buf), ""]
 
-- 
1.7.11.7



More information about the anaconda-patches mailing list