Turns out not all data is UTF-8, so don't try to decode it.

Fixes issue #204
This commit is contained in:
Lance Stout 2012-10-31 00:03:55 -07:00
parent 52feabbe76
commit 12e8bb6ddc
3 changed files with 16 additions and 16 deletions

View file

@ -85,7 +85,7 @@ class IBBReceiver(sleekxmpp.ClientXMPP):
def stream_opened(self, stream):
# NOTE: IBB streams are bi-directional, so the original sender is
# now the opened stream's receiver.
print('Stream opened: %s from ' % (stream.sid, stream.receiver))
print('Stream opened: %s from %s' % (stream.sid, stream.receiver))
# You could run a loop reading from the stream using stream.recv(),
# or use the ibb_stream_data event.

View file

@ -14,7 +14,7 @@ def to_b64(data):
def from_b64(data):
return bytes(base64.b64decode(bytes(data))).decode('utf-8')
return bytes(base64.b64decode(bytes(data)))
class Open(ElementBase):

View file

@ -174,7 +174,7 @@ class TestInBandByteStreams(SleekTest):
to="tester@localhost/receiver" />
""")
self.assertEqual(data, ['it works!'])
self.assertEqual(data, [b'it works!'])
suite = unittest.TestLoader().loadTestsFromTestCase(TestInBandByteStreams)