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

Vratislav Podzimek vpodzime at redhat.com
Thu Dec 4 10:25:41 UTC 2014


On Wed, 2014-12-03 at 17:24 -0800, Adam Williamson wrote:
> On Wed, 2014-12-03 at 18:55 -0500, Colin Walters wrote:
> > On Mon, Dec 1, 2014, at 11:32 PM, Adam Williamson wrote:
> > 
> > > +# 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')
> > 
> > See also:
> > https://mail.python.org/pipermail/python-dev/2008-February/077134.html
> > 
> > I think pygobject still carries that, though I'm only seeing it in the "pygtkcompat" layer.
> 
> So this was actually mentioned back when anaconda's *initial* hack to
> set utf-8 was added, the one that still works for non-live but has never
> worked for live. See
> https://bugzilla.redhat.com/show_bug.cgi?id=539904#c21 : "Why it does
> not happen during graphical install:
> because we do 'import gtk' which has a nasty side-effect of setting the
> default encoding to 'utf8', see:
> https://bugzilla.gnome.org/show_bug.cgi?id=132040"
> 
> These days, pygtk2 still has the hack, and it works, but anaconda
> doesn't use it any more. I agree with your assessment that pygobject3
> has it in pygtkcompat:
> 
> >>> import sys
> >>> print(sys.getdefaultencoding())
> ascii
> >>> import pygtkcompat
> >>> pygtkcompat.enable_gtk()
> >>> print(sys.getdefaultencoding())
> utf-8
> 
> but I don't *think* anaconda uses this stuff. So, it seems reasonable to
> guess that lives actually inherited the pygtk2 hack up until the switch
> to GTK+ 3, which I believe was newUI (i.e. 18), right?
Right. I still wonder why Python in 2014 ever sets default encoding to
ascii even when utf-8 is compatible with ascii.

-- 
Vratislav Podzimek

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



More information about the anaconda-patches mailing list