From 8444e76468b73569f18dda7ec506c84976a65b62 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Mon, 25 Feb 2013 11:37:15 +0000 Subject: [PATCH] Fix decoding of strings in ircmsgs. Thanks to monodemono. --- src/ircmsgs.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ircmsgs.py b/src/ircmsgs.py index 748314e89..bee105bb3 100644 --- a/src/ircmsgs.py +++ b/src/ircmsgs.py @@ -536,7 +536,7 @@ def kick(channel, nick, s='', prefix='', msg=None): if msg and not prefix: prefix = msg.prefix if sys.version_info[0] < 3 and isinstance(s, unicode): - s = s.decode('utf8') + s = s.encode('utf8') assert isinstance(s, str) if s: return IrcMsg(prefix=prefix, command='KICK', @@ -554,7 +554,7 @@ def kicks(channel, nicks, s='', prefix='', msg=None): if msg and not prefix: prefix = msg.prefix if sys.version_info[0] < 3 and isinstance(s, unicode): - s = s.decode('utf8') + s = s.encode('utf8') assert isinstance(s, str) if s: return IrcMsg(prefix=prefix, command='KICK', @@ -569,7 +569,7 @@ def privmsg(recipient, s, prefix='', msg=None): assert (isChannel(recipient) or isNick(recipient)), repr(recipient) assert s, 's must not be empty.' if sys.version_info[0] < 3 and isinstance(s, unicode): - s = s.decode('utf8') + s = s.encode('utf8') assert isinstance(s, str) if msg and not prefix: prefix = msg.prefix @@ -601,7 +601,7 @@ def notice(recipient, s, prefix='', msg=None): assert (isChannel(recipient) or isNick(recipient)), repr(recipient) assert s, 'msg must not be empty.' if sys.version_info[0] < 3 and isinstance(s, unicode): - s = s.decode('utf8') + s = s.encode('utf8') assert isinstance(s, str) if msg and not prefix: prefix = msg.prefix @@ -651,7 +651,7 @@ def part(channel, s='', prefix='', msg=None): if msg and not prefix: prefix = msg.prefix if sys.version_info[0] < 3 and isinstance(s, unicode): - s = s.decode('utf8') + s = s.encode('utf8') assert isinstance(s, str) if s: return IrcMsg(prefix=prefix, command='PART', @@ -667,7 +667,7 @@ def parts(channels, s='', prefix='', msg=None): if msg and not prefix: prefix = msg.prefix if sys.version_info[0] < 3 and isinstance(s, unicode): - s = s.decode('utf8') + s = s.encode('utf8') assert isinstance(s, str) if s: return IrcMsg(prefix=prefix, command='PART', @@ -696,7 +696,7 @@ def topic(channel, topic=None, prefix='', msg=None): args=(channel,), msg=msg) else: if sys.version_info[0] < 3 and isinstance(topic, unicode): - s = s.decode('utf8') + s = s.encode('utf8') assert isinstance(topic, str) return IrcMsg(prefix=prefix, command='TOPIC', args=(channel, topic), msg=msg)