3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-28 05:29:25 +01:00

Irc: catch UnicodeDecodeError when parsing lines

TODO: respect other encodings too?
This commit is contained in:
James Lu 2015-07-29 04:02:03 -07:00
parent 4d7d7ce428
commit ce822061d2

View File

@ -127,7 +127,8 @@ class Irc():
while b'\n' in buf: while b'\n' in buf:
line, buf = buf.split(b'\n', 1) line, buf = buf.split(b'\n', 1)
line = line.strip(b'\r') line = line.strip(b'\r')
line = line.decode("utf-8") # TODO: respect other encodings?
line = line.decode("utf-8", "replace")
log.debug("(%s) <- %s", self.name, line) log.debug("(%s) <- %s", self.name, line)
hook_args = None hook_args = None
try: try: