GrampsLocale: Ensure that encoding gets set to something

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

svn: r21616
This commit is contained in:
John Ralls 2013-03-11 22:44:29 +00:00
parent 29cf6674b5
commit 33d9b19ac7

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()