Skip to content

Commit

Permalink
Do not abort on non-UTF-8 texts
Browse files Browse the repository at this point in the history
  • Loading branch information
alterakey committed May 1, 2024
1 parent 52d889b commit ec34c91
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion trueseeing/app/cmd/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ async def _search_string(self, args: deque[str]) -> None:
for nr, t in enumerate(l.rstrip() for l in BytesIO(blob)):
m = re.search(pat.encode('utf-8'), t)
if m:
ui.info('{}:{:d}:{:d}: {}'.format(path, nr+1, m.start(), t.decode('utf-8')))
ui.info('{}:{:d}:{:d}: {}'.format(path, nr+1, m.start(), t.decode('utf-8', 'replace')))

def _looks_binary(self, b: bytes) -> bool:
return b'\x00' in b

0 comments on commit ec34c91

Please sign in to comment.