From c06689daff7c7fc0ba5abc7ce9ed7041ad095956 2011-09-17 10:28:29 From: Thomas Kluyver Date: 2011-09-17 10:28:29 Subject: [PATCH] Try locale encoding if stdin encoding is ascii. Starting the Qt console on Python 3, the kernel's stdin ends up with a .encoding of 'ascii' (whereas on Python 2 it is None). Since most platforms can handle a superset of ASCII, we may as well try locale.getpreferredencoding() in this case. --- diff --git a/IPython/utils/text.py b/IPython/utils/text.py index 9643900..cb40f41 100644 --- a/IPython/utils/text.py +++ b/IPython/utils/text.py @@ -47,7 +47,7 @@ def getdefaultencoding(): and usually ASCII. """ enc = sys.stdin.encoding - if not enc: + if not enc or enc=='ascii': try: # There are reports of getpreferredencoding raising errors # in some cases, which may well be fixed, but let's be conservative here.