From fe16d21212bacc9704a6cd84d3c85a6676936181 Mon Sep 17 00:00:00 2001 From: "Sean B. Palmer" Date: Wed, 29 Oct 2008 16:03:12 +0000 Subject: Oblique stuff and fixes. --- irc.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'irc.py') diff --git a/irc.py b/irc.py index e5bfdc3..281f5db 100755 --- a/irc.py +++ b/irc.py @@ -52,10 +52,14 @@ class Bot(asynchat.async_chat): def write(self, args, text=None): # This is a safe version of __write + def safe(input): + input = input.replace('\n', '') + input = input.replace('\r', '') + return input.encode('utf-8') try: - args = [arg.encode('utf-8') for arg in args] + args = [safe(arg) for arg in args] if text is not None: - text = text.encode('utf-8') + text = safe(text) self.__write(args, text) except Exception, e: pass -- cgit v1.2.3-1-g7c22