mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
Ignore UnicodeEncodeError in lprint
This commit is contained in:
parent
a33ba30092
commit
5b9039d825
1 changed files with 3 additions and 2 deletions
|
@ -90,13 +90,14 @@ def lprint(s='', end='\n', flush=False, prompt="[" + color("=", fg="yellow") +
|
||||||
- logfile (R)
|
- logfile (R)
|
||||||
"""
|
"""
|
||||||
s = f"{prompt}" + f"\n{prompt}".join(s.split('\n'))
|
s = f"{prompt}" + f"\n{prompt}".join(s.split('\n'))
|
||||||
print(s, end=end, flush=flush)
|
safe_s = s.encode('utf-8', errors='ignore').decode('utf-8')
|
||||||
|
print(safe_s, end=end, flush=flush)
|
||||||
|
|
||||||
if log is True:
|
if log is True:
|
||||||
global logbuffer
|
global logbuffer
|
||||||
if logfile is not None:
|
if logfile is not None:
|
||||||
with open(logfile, 'a', encoding='utf-8') as f:
|
with open(logfile, 'a', encoding='utf-8') as f:
|
||||||
f.write(s + end)
|
f.write(safe_s + end)
|
||||||
else:
|
else:
|
||||||
# buffering
|
# buffering
|
||||||
logbuffer += s + end
|
logbuffer += s + end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue