mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
String: Return raw bytes when decode returns binary data.
This commit is contained in:
parent
bcd39743f0
commit
981476d6d5
@ -143,7 +143,10 @@ class String(callbacks.Plugin):
|
|||||||
if sys.version_info[0] < 3 and isinstance(text, unicode):
|
if sys.version_info[0] < 3 and isinstance(text, unicode):
|
||||||
text = text.encode('utf-8')
|
text = text.encode('utf-8')
|
||||||
elif sys.version_info[0] >= 3 and isinstance(text, bytes):
|
elif sys.version_info[0] >= 3 and isinstance(text, bytes):
|
||||||
|
try:
|
||||||
text = text.decode()
|
text = text.decode()
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
pass
|
||||||
|
|
||||||
# Reply
|
# Reply
|
||||||
irc.reply(text)
|
irc.reply(text)
|
||||||
|
Loading…
Reference in New Issue
Block a user