Revert "remove even more unicode()/encode() calls."

turns out there was a reason why i did this one.
This reverts commit 1afa34554f.
This commit is contained in:
Brian S. Stephan 2010-10-27 23:12:46 -05:00
parent 1afa34554f
commit 898a4aa6c0
1 changed files with 7 additions and 1 deletions

View File

@ -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):