X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a47418db8f3c7533cdac6841a7ce49ffd6641e41..ccea21ccf8a8c7f2012c890c9c1b916d0e725db2:/wxPython/src/_core_ex.py diff --git a/wxPython/src/_core_ex.py b/wxPython/src/_core_ex.py index bb3658d73c..bd9ecf759e 100644 --- a/wxPython/src/_core_ex.py +++ b/wxPython/src/_core_ex.py @@ -67,7 +67,10 @@ if default == 'ascii': import locale import codecs try: - default = locale.getdefaultlocale()[1] + if hasattr(locale, 'getpreferredencoding'): + default = locale.getpreferredencoding() + else: + default = locale.getdefaultlocale()[1] codecs.lookup(default) except (ValueError, LookupError, TypeError): default = _sys.getdefaultencoding()