Ensure that the encoding returned from locale.getdefaultlocale() is
valid, default to sys.getdefaultencoding() if not. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32915 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
38f7d8013a
commit
0d5b83dc3c
@ -40,14 +40,17 @@ if RELEASE_VERSION != _core_.RELEASE_VERSION:
|
||||
# http://www.alanwood.net/demos/charsetdiffs.html for differences
|
||||
# between the common latin/roman encodings.
|
||||
import locale
|
||||
import codecs
|
||||
try:
|
||||
default = locale.getdefaultlocale()[1]
|
||||
except ValueError:
|
||||
default = "iso8859-1"
|
||||
codecs.lookup(default)
|
||||
except (ValueError, LookupError):
|
||||
default = _sys.getdefaultencoding()
|
||||
if default:
|
||||
wx.SetDefaultPyEncoding(default)
|
||||
del default
|
||||
del locale
|
||||
del codecs
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user