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

Vratislav Podzimek vpodzime at redhat.com
Tue Dec 2 06:20:53 UTC 2014


On Mon, 2014-12-01 at 20:32 -0800, Adam Williamson wrote:
> 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
As this hack was the first thing I tried and it worked, ACK.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list