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

Ascii encoding 2020 #5

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Ascii encoding 2020 #5

wants to merge 6 commits into from

Conversation

garethrees
Copy link
Member

No description provided.

crowbot and others added 6 commits October 23, 2015 18:40
Rake was failing because PKG_NAME was not defined.
Rescue from Encoding::CompatibilityError when converting Mapi::Mime to a String.

In some situations the parts can legitimately be different encodings,
but cannot be concatenated given the encoding differences.

In this situation, force the encoding to ASCII-8BIT rather than
erroring.
Copy spec added in 43c8797 that was used to test variations on the fix
for falling back to ASCII encoding. We finally settled on fae72e5 as a
fix, but didn’t introduce the spec for some reason.
In fae72e5 we introduced a fallback for incompatible character
encodings, but that only covered the case where Mapi::Mime#is_multipart?
returns true.

This is a slight variation for the other branch of the conditional.

The error is being raised where we have a `@body` in a different
encoding to the default string encoding. In this case, just always force
the string to be the same encoding as `@body` so we don’t get an error.

This passes the spec for the particular file we’re seeing problems with,
but I’m not at all sure this is the right thing to do. Maybe we should
always treat anything in mapi as ASCII, and then force to UTF-8 for
display? [1]

Fixes mysociety/alaveteli#5783

[1] aquasync#9 (comment)
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 this pull request may close these issues.

2 participants