[r21597]Grampslocale: Protect from crashes due to passing bad strings to
setlocale svn: r21600
This commit is contained in:
parent
a323c33c30
commit
1a5ad3b6f7
@ -212,9 +212,12 @@ class GrampsLocale(object):
|
|||||||
#numeric format. Those are fixed by the user's system settings.
|
#numeric format. Those are fixed by the user's system settings.
|
||||||
|
|
||||||
if not win():
|
if not win():
|
||||||
locale.setlocale(locale.LC_COLLATE, self.collation)
|
try:
|
||||||
locale.setlocale(locale.LC_TIME, self.calendar)
|
locale.setlocale(locale.LC_COLLATE, self.collation)
|
||||||
locale.setlocale(locale.LC_MONETARY, self.currency)
|
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:
|
#Next, we need to know what is the encoding from the native environment:
|
||||||
self.encoding = locale.getlocale()[1]
|
self.encoding = locale.getlocale()[1]
|
||||||
#GtkBuilder depends on reading Glade files as UTF-8 and crashes if it
|
#GtkBuilder depends on reading Glade files as UTF-8 and crashes if it
|
||||||
|
Loading…
Reference in New Issue
Block a user