]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/_core_ex.py
Don't include sys/socket.h on cygwin in windows mode
[wxWidgets.git] / wxPython / src / _core_ex.py
index f19ca7ecd7b1c3e64122a5c09b9b878ee036e70c..0e5a51307b85f7bb31073ac6a24dafa3a817be3c 100644 (file)
@@ -39,15 +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
-try:
-    default = locale.getdefaultlocale()[1]
-except ValueError:
-    default = "iso8859-1"
+
+default = _sys.getdefaultencoding()
+if default == 'ascii':
+    import locale
+    import codecs
+    try:
+        default = locale.getdefaultlocale()[1]
+        codecs.lookup(default)
+    except (ValueError, LookupError, TypeError):
+        default = _sys.getdefaultencoding()
+    del locale
+    del codecs
 if default:
     wx.SetDefaultPyEncoding(default)
 del default
-del locale
 
 #----------------------------------------------------------------------------