##// END OF EJS Templates
Backport PR #2500: Add `encoding` attribute to `OutStream` class....
MinRK -
Show More
@@ -4,7 +4,7 b' from io import StringIO'
4 4
5 5 from session import extract_header, Message
6 6
7 from IPython.utils import io, text, encoding
7 from IPython.utils import io, text
8 8
9 9 #-----------------------------------------------------------------------------
10 10 # Globals
@@ -22,6 +22,7 b' class OutStream(object):'
22 22 topic=None
23 23
24 24 def __init__(self, session, pub_socket, name):
25 self.encoding = 'UTF-8'
25 26 self.session = session
26 27 self.pub_socket = pub_socket
27 28 self.name = name
@@ -69,8 +70,7 b' class OutStream(object):'
69 70 else:
70 71 # Make sure that we're handling unicode
71 72 if not isinstance(string, unicode):
72 enc = encoding.DEFAULT_ENCODING
73 string = string.decode(enc, 'replace')
73 string = string.decode(self.encoding, 'replace')
74 74
75 75 self._buffer.write(string)
76 76 current_time = time.time()
General Comments 0
You need to be logged in to leave comments. Login now