From 553d82ba3441e8596ab20761fbe89f01b7ec0e39 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Mon, 11 Mar 2013 22:54:43 +0000 Subject: [PATCH] [r21616]GrampsLocale: Ensure that encoding gets set to something In the C locale, locale.getlocale() returns [None, None] svn: r21621 --- gramps/gen/utils/grampslocale.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gramps/gen/utils/grampslocale.py b/gramps/gen/utils/grampslocale.py index 9c3e17c78..61c26d1c1 100644 --- a/gramps/gen/utils/grampslocale.py +++ b/gramps/gen/utils/grampslocale.py @@ -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()