Skip to content

Commit

Permalink
ENH: try to detect encoding via sys.stdout first, then sys.stdin
Browse files Browse the repository at this point in the history
when redirected to a file stdout is None, in ipython zmq frontends
stdin is None, and stdout (only recently in 0.14) is utf-8.

ipython/ipython#2500
  • Loading branch information
y-p committed Dec 9, 2012
1 parent f5fb54b commit 7cc9779
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pandas/core/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -1274,11 +1274,11 @@ def detect_console_encoding():

encoding = None
try:
encoding=sys.stdin.encoding
encoding = sys.stdout.encoding or sys.stdin.encoding
except AttributeError:
pass

if not encoding or encoding =='ascii': # try again for something better
if not encoding or encoding == 'ascii': # try again for something better
try:
encoding = locale.getpreferredencoding()
except Exception:
Expand Down

0 comments on commit 7cc9779

Please sign in to comment.