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

Invalid utf-7 data in body causes exceptions #1404

Open
pdg137 opened this issue Aug 15, 2020 · 0 comments · May be fixed by #1405
Open

Invalid utf-7 data in body causes exceptions #1404

pdg137 opened this issue Aug 15, 2020 · 0 comments · May be fixed by #1405

Comments

@pdg137
Copy link

pdg137 commented Aug 15, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant