⏪ Switch lines read from serial back to bytes

While long term we want to have unicode here, the rest of the code
is not even remotely prepared for handling utf-8 strings as visible in
the large amount of unicode issues visible in sentry.

So for now we go back to byte objects and fix #3091 differently
This commit is contained in:
Gina Häußge committed 2019-04-10 17:15:58 +02:00
1 parent 9775d99feb
commit 68952c20bd
1 file changed
+6 -7
+6 -7
View File
@@ -2746,13 +2746,12 @@ class MachineCom(object):
self.close(is_error=True)
return None
try:
ret = ret.decode('utf-8').rstrip()
except UnicodeDecodeError:
ret = ret.decode('latin1').rstrip()
if ret != u"":
self._log(u"Recv: {}".format(ret))
if ret != "":
try:
self._log("Recv: " + sanitize_ascii(ret))
except ValueError as e:
self._log("WARN: While reading last line: %s" % e)
self._log("Recv: " + repr(ret))
for name, hook in self._received_message_hooks.items():
try: