Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

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.
  • Loading branch information...
commit c06689daff7c7fc0ba5abc7ce9ed7041ad095956 1 parent 2cda1d8
@takluyver authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  IPython/utils/
2  IPython/utils/
@@ -47,7 +47,7 @@ def getdefaultencoding():
and usually ASCII.
enc = sys.stdin.encoding
- if not enc:
+ if not enc or enc=='ascii':
# There are reports of getpreferredencoding raising errors
# in some cases, which may well be fixed, but let's be conservative here.

0 comments on commit c06689d

Please sign in to comment.
Something went wrong with that request. Please try again.