Fix error handling for decoding errors

This commit is contained in:
Jan Philipp Timme 2020-01-30 15:04:24 +01:00
parent eb1fa14665
commit 907f0fe7b7
1 changed files with 1 additions and 1 deletions

View File

@ -34,7 +34,7 @@ def get_decoded_header(value):
for item in decoded_header_items:
decoded_item = item[0].decode(item[1]) if item[1] is not None else item[0]
if isinstance(decoded_item, bytes):
decoded_item = decoded_item.decode('ascii')
decoded_item = decoded_item.decode('ascii', 'replace')
decoded_header_value += decoded_item
return decoded_header_value