Skip to content

Commit

Permalink
Merge a116211 into 65ae0d1
Browse files Browse the repository at this point in the history
  • Loading branch information
traverseda committed Aug 15, 2021
2 parents 65ae0d1 + a116211 commit a8cfaed
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion textract/parsers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ def decode(self, text, input_encoding=None):

# use chardet to automatically detect the encoding text if no encoding is provided
result = chardet.detect(text)
return text.decode(result['encoding'], errors="replace")
encoding = result['encoding'] if result['confidence'] > 0.80 else 'utf8'
return text.decode(encoding, errors="replace")


class ShellParser(BaseParser):
Expand Down

0 comments on commit a8cfaed

Please sign in to comment.