Homec4science

Fix encodings for mime headers and body if not UTF-8

Authored by David Reuss <david@upsys.dk> on Dec 2 2011, 17:47.

Description

Fix encodings for mime headers and body if not UTF-8

Summary:
If mails are not sent in UTF-8 we cannot just it verbatim, so we have to
encode it into UTF-8 if it is not the case. Mime headers use different
encodings like "quoted-printable", which we have to handle.

It looks like "Subject: =?iso-8859-1?Q?opr=E6t_s=E5_den_task?=", and can
be decoded by iconv_mime_decode.

Furthermore the body of the email might be in various encodings as well,
which we attempt to pull from the content-type header of the plain text
part of the mail.

Test Plan:
Attempted receiving mails in a variety of flavors. These could be
converted to test-cases once i know if this is a sane solution. Got
expected results from mails sent with Windows-1252 and ISO-8859-1.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, epriestley, davidreuss

Differential Revision: 1093

Details

Committed
epriestley <git@epriestley.com>Dec 2 2011, 17:47
Pushed
aubortJan 31 2017, 17:16
Parents
rPHc2054bab0916: Support limiting maniphest queries to specific ids
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPHdc0d3f3fef23: Fix encodings for mime headers and body if not UTF-8 (authored by David Reuss <david@upsys.dk>).Dec 2 2011, 17:47