Comment 0 for bug 27112

Revision history for this message
Andrew Bennetts (spiv) wrote :

>>> import sys
>>> print sys.getdefaultencoding()
'ascii'
>>> import gtk
>>> print sys.getdefaultencoding()
'utf-8'

This is bad. It is generally a bad idea for a library to change global state
that may break other libraries; it's worse that it does this as a side-effect of
merely being imported. sys.setdefaultencoding is also generally considered a
misfeature by the Python developers, and changing the default encoding from
'ascii' (except perhaps to 'undefined') is asking for potential bugs to be
hidden, rather than raising exceptions when you'd expect. There's a reason
sys.setdefaultencoding is not accessible by default.