[GH-ISSUE #94] All e-mail content is interpreted as UTF-8, leading to a UnicodeDecodeError for some e-mails in a different encoding. #67

Closed
opened 2026-02-25 23:39:46 +03:00 by kerem · 2 comments
Owner

Originally created by @geraldschmittinger on GitHub (Jan 8, 2025).
Original GitHub issue: https://github.com/HaschekSolutions/opentrashmail/issues/94

I encountered an issue with Open Trashmail:

When I send an e-mail in ISO-8859-1 encoding containing an ä, this causes the e-mail to be rejected due to a UniformDecodeError.

I figured that the reason for this is that in python/mailserver3.py (line 52), the content of the e-mail is always parsed as UTF-8. However, in ISO-8859-1, an ä has the code 0xE4, which is a continuation byte in UTF-8. When the character preceding this byte cannot validly be continued, the text is not valid unicode and therefore causes this error.

Originally created by @geraldschmittinger on GitHub (Jan 8, 2025). Original GitHub issue: https://github.com/HaschekSolutions/opentrashmail/issues/94 I encountered an issue with Open Trashmail: When I send an e-mail in ISO-8859-1 encoding containing an `ä`, this causes the e-mail to be rejected due to a `UniformDecodeError`. I figured that the reason for this is that in [python/mailserver3.py (line 52)](https://github.com/HaschekSolutions/opentrashmail/blob/278856f75a586e7f31625e2c028a54e1ebc5887b/python/mailserver3.py#L52), the content of the e-mail is always parsed as UTF-8. However, in ISO-8859-1, an `ä` has the code `0xE4`, which is a continuation byte in UTF-8. When the character preceding this byte cannot validly be continued, the text is not valid unicode and therefore causes this error.
kerem closed this issue 2026-02-25 23:39:46 +03:00
Author
Owner

@RyanZufaellig commented on GitHub (Jan 17, 2025):

Hello,
There is already a commit waiting to be accepted: https://github.com/HaschekSolutions/opentrashmail/pull/93/commits/9aeae959c29e9d554347a12dea71f7be7918b619
I made the changes myself, and it worked flawlessly.

<!-- gh-comment-id:2598486675 --> @RyanZufaellig commented on GitHub (Jan 17, 2025): Hello, There is already a commit waiting to be accepted: https://github.com/HaschekSolutions/opentrashmail/pull/93/commits/9aeae959c29e9d554347a12dea71f7be7918b619 I made the changes myself, and it worked flawlessly.
Author
Owner

@geraldschmittinger commented on GitHub (Apr 25, 2025):

Thank you!

<!-- gh-comment-id:2831542069 --> @geraldschmittinger commented on GitHub (Apr 25, 2025): Thank you!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/opentrashmail#67
No description provided.