##// 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 from session import extract_header, Message
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 # Globals
10 # Globals
@@ -22,6 +22,7 b' class OutStream(object):'
22 topic=None
22 topic=None
23
23
24 def __init__(self, session, pub_socket, name):
24 def __init__(self, session, pub_socket, name):
25 self.encoding = 'UTF-8'
25 self.session = session
26 self.session = session
26 self.pub_socket = pub_socket
27 self.pub_socket = pub_socket
27 self.name = name
28 self.name = name
@@ -69,8 +70,7 b' class OutStream(object):'
69 else:
70 else:
70 # Make sure that we're handling unicode
71 # Make sure that we're handling unicode
71 if not isinstance(string, unicode):
72 if not isinstance(string, unicode):
72 enc = encoding.DEFAULT_ENCODING
73 string = string.decode(self.encoding, 'replace')
73 string = string.decode(enc, 'replace')
74
74
75 self._buffer.write(string)
75 self._buffer.write(string)
76 current_time = time.time()
76 current_time = time.time()
General Comments 0
You need to be logged in to leave comments. Login now