[f21-branch][master][PATCH 2/2] sgallagh: force defaultencoding to utf-8 on live (#1169019)

Adam Williamson awilliam at redhat.com
Tue Dec 2 04:32:52 UTC 2014


This has been done via pyanaconda/sitecustomize.py for non-live
since Fedora 13, per #539904, commit 42a0227. However, that hack
never worked for the live environment. This hack is about
equally hacky, but works for live as well. This avoids crashes
when we get unicode objects from pyparted and try to encode
them. Written by Stephen Gallagher, he and I have tested that
it resolves the crashes seen in F21 RC1 without breaking
translations.
---
 pyanaconda/anaconda.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/pyanaconda/anaconda.py b/pyanaconda/anaconda.py
index 57116bb..d2c6df0 100644
--- a/pyanaconda/anaconda.py
+++ b/pyanaconda/anaconda.py
@@ -28,6 +28,11 @@
 
 import os
 import sys
+# force python's default encoding to be utf-8, not ascii. all the ways to
+# do this are bad, but this at least works for live and non-live.
+# see RHBZ #1169019, RHBZ #539904
+reload(sys)
+sys.setdefaultencoding('utf-8')
 import stat
 from glob import glob
 from tempfile import mkstemp
-- 
2.1.0



More information about the anaconda-patches mailing list