# 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):
+ default = _sys.getdefaultencoding()
+ del locale
+ del codecs
if default:
wx.SetDefaultPyEncoding(default)
del default
-del locale
#----------------------------------------------------------------------------