[r21616]GrampsLocale: Ensure that encoding gets set to something

In the C locale, locale.getlocale() returns [None, None]

svn: r21621
This commit is contained in:
John Ralls 2013-03-11 22:54:43 +00:00
parent bd61f08873
commit 553d82ba34

View File

@ -223,6 +223,11 @@ class GrampsLocale(object):
pass
#Next, we need to know what is the encoding from the native environment:
self.encoding = locale.getlocale()[1]
if not self.encoding:
self.encoding = locale.getpreferredencoding()
if not self.encoding:
self.encoding = 'utf-8'
#GtkBuilder depends on reading Glade files as UTF-8 and crashes if it
#doesn't, so set $LANG to have a UTF-8 locale. NB: This does *not*
#affect locale.getpreferredencoding() or sys.getfilesystemencoding()