Work around Mac OS X platform encoding issues.
authorTony Lownds <tony@lownds.com>
Mon, 23 Sep 2002 01:01:20 +0000 (01:01 +0000)
committerTony Lownds <tony@lownds.com>
Mon, 23 Sep 2002 01:01:20 +0000 (01:01 +0000)
Lib/idlelib/IOBinding.py

index 58d1913c7e81b4d69c2c60e15024b058bf5ef6f5..10129e9b71fb60b1cd506d23483e1d6342cc62c0 100644 (file)
@@ -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