X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5917d04127f414f0c2cd400581cb1c47395a3479..9e477492e29e03c02827b1e42a16cb09a13f5149:/wxPython/src/msw/_core.py?ds=sidebyside diff --git a/wxPython/src/msw/_core.py b/wxPython/src/msw/_core.py index e5794e1ae4..f9cf4a8438 100644 --- a/wxPython/src/msw/_core.py +++ b/wxPython/src/msw/_core.py @@ -13713,7 +13713,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()