Skip to content

Commit

Permalink
util.metafile: fix decoding problem
Browse files Browse the repository at this point in the history
  • Loading branch information
pyroscope committed Aug 3, 2020
1 parent 8d0bf6e commit 337941d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/pyrocore/util/metafile.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,9 @@ def sane_encoding(field, text):
# Broken beyond anything reasonable
bad_encodings.add('UNKNOWN/EXOTIC')
bad_fields.add(field)
return six.text_type(text, 'utf-8', 'replace').replace('\ufffd', '_').encode("utf-8")
if not isinstance(text, six.text_type):
text = six.text_type(text, 'utf-8', 'replace')
return text.replace('\ufffd', '_').encode("utf-8")

# Go through all string fields and check them
for field in ("comment", "created by"):
Expand Down

0 comments on commit 337941d

Please sign in to comment.