Dont try to color non-utf8
This commit is contained in:
parent
94890226e6
commit
92246fc7be
@ -101,7 +101,11 @@ class Output:
|
|||||||
)
|
)
|
||||||
|
|
||||||
def highlight(self, line, highlight=True):
|
def highlight(self, line, highlight=True):
|
||||||
|
try:
|
||||||
line = line.decode('utf8') if isinstance(line, bytes) else line
|
line = line.decode('utf8') if isinstance(line, bytes) else line
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
highlight = False
|
||||||
|
|
||||||
if not highlight or (
|
if not highlight or (
|
||||||
'\x1b[' in line
|
'\x1b[' in line
|
||||||
or '\033[' in line
|
or '\033[' in line
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user