[r21597]Grampslocale: Protect from crashes due to passing bad strings to

setlocale

svn: r21600
This commit is contained in:
John Ralls 2013-03-09 22:38:05 +00:00
parent a323c33c30
commit 1a5ad3b6f7

View File

@ -212,9 +212,12 @@ class GrampsLocale(object):
#numeric format. Those are fixed by the user's system settings.
if not win():
locale.setlocale(locale.LC_COLLATE, self.collation)
locale.setlocale(locale.LC_TIME, self.calendar)
locale.setlocale(locale.LC_MONETARY, self.currency)
try:
locale.setlocale(locale.LC_COLLATE, self.collation)
locale.setlocale(locale.LC_TIME, self.calendar)
locale.setlocale(locale.LC_MONETARY, self.currency)
except locale.Error:
pass
#Next, we need to know what is the encoding from the native environment:
self.encoding = locale.getlocale()[1]
#GtkBuilder depends on reading Glade files as UTF-8 and crashes if it