From 0d17c0577b6e816dc1c6e02667fc03f74ef5f4a8 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Mon, 18 Jan 2016 22:40:36 +0100 Subject: [PATCH] In recv_line(), handle UnicodeDecodeErrors by assuming latin1. --- plomlombot.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plomlombot.py b/plomlombot.py index 81be31f..0b605e9 100755 --- a/plomlombot.py +++ b/plomlombot.py @@ -67,7 +67,11 @@ class IO: self._pingtest(send_ping) return None self.last_pong = time.time() - received_runes = self.socket.recv(1024).decode("UTF-8") + received_bytes = self.socket.recv(1024) + try: + received_runes = received_bytes.decode("UTF-8") + except UnicodeDecodeError: + received_runes = received_bytes.decode("latin1") if len(received_runes) == 0: print("SOCKET CONNECTION BROKEN") raise ExceptionForRestart -- 2.30.2