The following results in an Encoding::InvalidByteSequenceError:
Mail::Part.new("Content-Type: text/plain; charset=\"utf-7\"\r\n\r\n&5g-").decoded
The equivalent using quoted-printable makes use of the replacement character:
irb(main):005:0> Mail::Part.new("Content-Type: text/plain; charset=\"utf-8\"\r\n" +
"Content-Transfer-Encoding: quoted-printable\r\n\r\n=E6").decoded
=> "�"
There are explicit tests that in B encodings we capture encoding errors and revert to displaying the raw text, but there's nothing trapping such errors when decoding the message body.
Should a utf-7 body work like quoted-printable or like a utf-7 header? In any case, it seems like a bad idea to let encoding-related exceptions bubble up to the application.
The following results in an
Encoding::InvalidByteSequenceError:The equivalent using quoted-printable makes use of the replacement character:
There are explicit tests that in B encodings we capture encoding errors and revert to displaying the raw text, but there's nothing trapping such errors when decoding the message body.
Should a utf-7 body work like quoted-printable or like a utf-7 header? In any case, it seems like a bad idea to let encoding-related exceptions bubble up to the application.