]> git.saurik.com Git - wxWidgets.git/commitdiff
Ensure that the encoding returned from locale.getdefaultlocale() is
authorRobin Dunn <robin@alldunn.com>
Sat, 19 Mar 2005 21:52:49 +0000 (21:52 +0000)
committerRobin Dunn <robin@alldunn.com>
Sat, 19 Mar 2005 21:52:49 +0000 (21:52 +0000)
valid, default to sys.getdefaultencoding() if not.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32915 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/src/_core_ex.py

index f19ca7ecd7b1c3e64122a5c09b9b878ee036e70c..caaf2a8058f8c5919d2d8b5f96fa6bb596b1bf15 100644 (file)
@@ -40,14 +40,17 @@ if RELEASE_VERSION != _core_.RELEASE_VERSION:
 # http://www.alanwood.net/demos/charsetdiffs.html for differences
 # between the common latin/roman encodings.
 import locale
+import codecs
 try:
     default = locale.getdefaultlocale()[1]
-except ValueError:
-    default = "iso8859-1"
+    codecs.lookup(default)
+except (ValueError, LookupError):
+    default = _sys.getdefaultencoding()
 if default:
     wx.SetDefaultPyEncoding(default)
 del default
 del locale
+del codecs
 
 #----------------------------------------------------------------------------