String: Return raw bytes when decode returns binary data.

This commit is contained in:
Valentin Lorentz 2015-02-11 14:09:16 +00:00
parent bcd39743f0
commit 981476d6d5

View File

@ -143,7 +143,10 @@ class String(callbacks.Plugin):
if sys.version_info[0] < 3 and isinstance(text, unicode):
text = text.encode('utf-8')
elif sys.version_info[0] >= 3 and isinstance(text, bytes):
text = text.decode()
try:
text = text.decode()
except UnicodeDecodeError:
pass
# Reply
irc.reply(text)