From dd898dd8bd6edd95323cb4fa54564ed2dcdfdd65 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 24 Mar 2005 16:45:57 +0000 Subject: [PATCH] Only use locale.getdefaultlocale()[1] if sys.getdefaultencoding() is still "ascii" git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33025 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/src/_core_ex.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/wxPython/src/_core_ex.py b/wxPython/src/_core_ex.py index caaf2a8058..45f7eeab6d 100644 --- a/wxPython/src/_core_ex.py +++ b/wxPython/src/_core_ex.py @@ -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 #---------------------------------------------------------------------------- -- 2.47.2