Skip to content

Commit

Permalink
decode file log as latin-1 first (utf-8 as backup)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshduran committed May 10, 2024
1 parent 96257f5 commit 321c6a7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions brukeropus/file/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,10 @@ def parse_file_log(filebytes: bytes, size: int, start: int):
for entry in byte_strings:
if entry != b'':
try:
strings.append(entry.decode('utf-8'))
strings.append(entry.decode('latin-1'))
except Exception:
try:
strings.append(entry.decode('latin-1'))
strings.append(entry.decode('utf-8'))
except Exception as e:
strings.append('<Decode Exception>: ' + str(e))
return strings

0 comments on commit 321c6a7

Please sign in to comment.