Skip to content

Commit

Permalink
String: Return raw bytes when decode returns binary data.
Browse files Browse the repository at this point in the history
  • Loading branch information
progval committed Feb 11, 2015
1 parent bcd3974 commit 981476d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion plugins/String/plugin.py
Expand Up @@ -143,7 +143,10 @@ def decode(self, irc, msg, args, encoding, text):
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)
Expand Down

0 comments on commit 981476d

Please sign in to comment.