Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partially handle iso-8859-8-i encoding #298

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions django_mailbox/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,12 @@ def _get_dehydrated_message(self, msg, record):
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
Expand Down
2 changes: 2 additions & 0 deletions django_mailbox/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ def _decode(value, encoding):
return value
if not encoding or encoding == 'unknown-8bit':
encoding = default_charset
elif encoding == 'iso-8859-8-i':
encoding = 'iso-8859-8'
return value.decode(encoding, 'replace')

try:
Expand Down