From 898a4aa6c092ecd99934d06fbbd7b7abd4853c1e Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Wed, 27 Oct 2010 23:12:46 -0500 Subject: [PATCH] Revert "remove even more unicode()/encode() calls." turns out there was a reason why i did this one. This reverts commit 1afa34554f82103532a12d98ac05aecef18f2e67. --- dr.botzo.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dr.botzo.py b/dr.botzo.py index 759bae1..f153b3c 100644 --- a/dr.botzo.py +++ b/dr.botzo.py @@ -52,15 +52,21 @@ class DrBotServerConnection(irclib.ServerConnection): splitpos = text.rfind(' ', 0, splitspace) splittext = text[0:splitpos] + ' ' + splitter text = splitter + ' ' + text[splitpos+1:] - self.send_raw("PRIVMSG %s :%s" % (target, splittext)) + self.send_raw("PRIVMSG %s :%s" % (target, unicode(splittext).encode('utf-8'))) times = times + 1 if times >= 4: return # done splitting + try: + text = unicode(text).encode('utf-8') + except UnicodeDecodeError: pass self.send_raw("PRIVMSG %s :%s" % (target, text)) else: + try: + text = unicode(text).encode('utf-8') + except UnicodeDecodeError: pass self.send_raw("PRIVMSG %s :%s" % (target, text)) class DrBotIRC(irclib.IRC):