diff options
author | Tony Lownds <tony@lownds.com> | 2002-09-23 01:01:20 (GMT) |
---|---|---|
committer | Tony Lownds <tony@lownds.com> | 2002-09-23 01:01:20 (GMT) |
commit | e555fc76a762a830ed067993fd6073bc69da123f (patch) | |
tree | 05bc65d2ee6032a32eee0aad4e3b5dd322667441 /Lib | |
parent | f18efa56437ea50fac959c9dde5055ce05da2237 (diff) | |
download | cpython-e555fc76a762a830ed067993fd6073bc69da123f.zip cpython-e555fc76a762a830ed067993fd6073bc69da123f.tar.gz cpython-e555fc76a762a830ed067993fd6073bc69da123f.tar.bz2 |
Work around Mac OS X platform encoding issues.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/idlelib/IOBinding.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/idlelib/IOBinding.py b/Lib/idlelib/IOBinding.py index 58d1913..10129e9 100644 --- a/Lib/idlelib/IOBinding.py +++ b/Lib/idlelib/IOBinding.py @@ -65,6 +65,9 @@ else: # resulting codeset may be unknown to Python. We ignore all # these problems, falling back to ASCII encoding = locale.nl_langinfo(locale.CODESET) + if encoding is None: + # situation occurs on Mac OS X + encoding = 'ascii' codecs.lookup(encoding) except (NameError, AttributeError, LookupError): # Try getdefaultlocale well: it parses environment variables, @@ -72,6 +75,9 @@ else: # bugs that can cause ValueError. try: encoding = locale.getdefaultlocale()[1] + if encoding is None: + # situation occurs on Mac OS X + encoding = 'ascii' codecs.lookup(encoding) except (ValueError, LookupError): pass |