From 180cb159a7532c9f2ad1f235e21735624e7c2fe5 Mon Sep 17 00:00:00 2001 From: iou1name Date: Fri, 13 Sep 2019 19:01:08 -0400 Subject: [PATCH] add error handling for broken unicode --- bot.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bot.py b/bot.py index b3b1467..adab7bf 100755 --- a/bot.py +++ b/bot.py @@ -616,6 +616,13 @@ class Fulvia(irc.IRCClient): self.whoisIdle(nick, idle, signon) + def lineReceived(self, line): + """Overridden to fix broken unicode issues.""" + if bytes != str and isinstance(line, bytes): + line = line.decode('utf-8', errors='surrogateescape') + super().lineReceived(line) + + class FulviaWrapper(): """ A wrapper class for Fulvia to provide default destinations for msg