##// END OF EJS Templates
Backport PR #8260: use stdout.encoding for decoding pretty bytes...
Min RK -
Show More
@@ -112,6 +112,7 b' import datetime'
112 from collections import deque
112 from collections import deque
113
113
114 from IPython.utils.py3compat import PY3, cast_unicode
114 from IPython.utils.py3compat import PY3, cast_unicode
115 from IPython.utils.encoding import get_stream_enc
115
116
116 from io import StringIO
117 from io import StringIO
117
118
@@ -140,7 +141,8 b' else:'
140 class CUnicodeIO(StringIO):
141 class CUnicodeIO(StringIO):
141 """StringIO that casts str to unicode on Python 2"""
142 """StringIO that casts str to unicode on Python 2"""
142 def write(self, text):
143 def write(self, text):
143 return super(CUnicodeIO, self).write(cast_unicode(text))
144 return super(CUnicodeIO, self).write(
145 cast_unicode(text, encoding=get_stream_enc(sys.stdout)))
144
146
145
147
146 def pretty(obj, verbose=False, max_width=79, newline='\n', max_seq_length=MAX_SEQ_LENGTH):
148 def pretty(obj, verbose=False, max_width=79, newline='\n', max_seq_length=MAX_SEQ_LENGTH):
General Comments 0
You need to be logged in to leave comments. Login now