Created
October 2, 2024 22:56
-
-
Save carlosveliz/54aea7071c5229ec7d3fab5747cd44fa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def decode_subject(parts): | |
subject_parts = [] | |
for part, encoding in parts: | |
if isinstance(part, bytes): | |
subject_parts.append(part.decode(encoding if encoding else 'utf-8', errors='replace')) | |
else: | |
subject_parts.append(part) | |
return ''.join(subject_parts) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment