Skip to content

Commit 90592de

Browse files
trnilatony
authored andcommitted
console_to_str: ignore invalid utf-8 (#70)
1 parent d9a84dd commit 90592de

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

libtmux/_compat.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def implements_to_string(cls):
4242
return cls
4343

4444
def console_to_str(s):
45-
return s.decode('utf_8')
45+
return s.decode('utf_8', 'ignore')
4646

4747
else:
4848
unichr = chr
@@ -79,9 +79,9 @@ def console_to_str(s):
7979
def console_to_str(s):
8080
""" From pypa/pip project, pip.backwardwardcompat. License MIT. """
8181
try:
82-
return s.decode(console_encoding)
82+
return s.decode(console_encoding, 'ignore')
8383
except UnicodeDecodeError:
84-
return s.decode('utf_8')
84+
return s.decode('utf_8', 'ignore')
8585

8686
def reraise(tp, value, tb=None):
8787
if value.__traceback__ is not tb:

0 commit comments

Comments
 (0)