]> git.saurik.com Git - wxWidgets.git/commitdiff
Only use locale.getdefaultlocale()[1] if sys.getdefaultencoding() is
authorRobin Dunn <robin@alldunn.com>
Thu, 24 Mar 2005 16:45:57 +0000 (16:45 +0000)
committerRobin Dunn <robin@alldunn.com>
Thu, 24 Mar 2005 16:45:57 +0000 (16:45 +0000)
still "ascii"

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

wxPython/src/_core_ex.py

index caaf2a8058f8c5919d2d8b5f96fa6bb596b1bf15..45f7eeab6d73aaa96060c9547802951af4a717ee 100644 (file)
@@ -39,18 +39,21 @@ if RELEASE_VERSION != _core_.RELEASE_VERSION:
 # different on different platforms.  For example, please see
 # http://www.alanwood.net/demos/charsetdiffs.html for differences
 # between the common latin/roman encodings.
-import locale
-import codecs
-try:
-    default = locale.getdefaultlocale()[1]
-    codecs.lookup(default)
-except (ValueError, LookupError):
-    default = _sys.getdefaultencoding()
+
+default = _sys.getdefaultencoding()
+if default == 'ascii':
+    import locale
+    import codecs
+    try:
+        default = locale.getdefaultlocale()[1]
+        codecs.lookup(default)
+    except (ValueError, LookupError):
+        default = _sys.getdefaultencoding()
+    del locale
+    del codecs
 if default:
     wx.SetDefaultPyEncoding(default)
 del default
-del locale
-del codecs
 
 #----------------------------------------------------------------------------