When you use Quoted Printable (QP) Content Transfer Encoding (CTE), reading the message body via .body.to_s does not observe the original encoding of the message body before Content Transfer Encoding.
There may well be other Content Transfer Encodings that have a similar issue. This should solve those cases too, but the test coverage is specific to QP, since adding a test all possible CTEs is overkill IMHO.
When you use Quoted Printable (QP) Content Transfer Encoding (CTE), reading the message body via
.body.to_s
does not observe the original encoding of the message body before Content Transfer Encoding.The API for this in the mail gem is somewhat non obvious, but the correct way to read the message body is via calling
.decoded
directly on the part in question (see https://github.com/mikel/mail/issues/618, https://github.com/mikel/mail/issues/403, https://github.com/mikel/mail/issues/512 for further details).There may well be other Content Transfer Encodings that have a similar issue. This should solve those cases too, but the test coverage is specific to QP, since adding a test all possible CTEs is overkill IMHO.