From 6f2113a064d262abd43b5aaeeff633164e34b769 Mon Sep 17 00:00:00 2001 From: ptav <7433752+ptav@users.noreply.github.com> Date: Thu, 3 Oct 2024 14:19:30 +0100 Subject: [PATCH] Cast iso-8859-8-i down to iso-8859-8 Attempt to do a better job than simply treating the email as ASCII --- django_mailbox/models.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/django_mailbox/models.py b/django_mailbox/models.py index 4c76dc5..8ab6ce1 100644 --- a/django_mailbox/models.py +++ b/django_mailbox/models.py @@ -374,6 +374,12 @@ class Mailbox(models.Model): content_charset = msg.get_content_charset() if not content_charset: content_charset = 'ascii' + elif content_charset == 'iso-8859-8-i': + content_charset = 'iso-8859-8' + logger.warning( + "Unhandled encoding %s; interpreting as iso-8859-8", + content_charset + ) try: # Make sure that the payload can be properly decoded in the # defined charset, if it can't, let's mash some things