Handle unstructured field with UTF-7 encoded-word #650

Closed
wants to merge 6 commits into
from

Projects

None yet

5 participants

@johngrimes
Contributor

Attempting to parse an email with the following header:

References: =?utf-7?B?PDEyMzRAdGVzdC5saW5kc2Fhci5uZXQ+?=

Will cause an error: Encoding::ConverterNotFoundError: code converter not found (UTF-7 to UTF-8).

This can be fixed by checking for UTF-7 within the b_value_decode method and using Net::IMAP to decode the string first.

@johngrimes johngrimes Decode UTF-7 with Net::IMAP before UTF-8 conversion
This prevents an Encoding::ConverterNotFoundError when trying to parse an
unstructured field with a UTF-7 encoded-word.
98b5c05
@tdg5
tdg5 commented Aug 25, 2015

I'm not sure when it was fixed, but this appears to work on v2.6.3. It still gives a warning, but otherwise seems like this PR could be closed?

::Mail::Encodings.value_decode("=?utf-7?B?PDEyMzRAdGVzdC5saW5kc2Fhci5uZXQ+?=")
# Encoding conversion failed code converter not found (UTF-7 to UTF-8)
"<1234@test.lindsaar.net>"
@thegcat thegcat pushed a commit to planio-gmbh/mail that referenced this pull request Jan 13, 2016
Felix Schäfer Support UTF-7 in unstructerd fields #248761
Losely adapted from mikel#650
ced6d6c
@jkraemer jkraemer added a commit to planio-gmbh/mail that referenced this pull request Jun 7, 2016
@jkraemer Felix Schäfer + jkraemer Support UTF-7 in unstructerd fields #248761
Losely adapted from mikel#650
b547565
@ahorek ahorek referenced this pull request Dec 14, 2016
Closed

fix invalid encoding #1061

@jeremy jeremy added this to the 2.7.0 milestone Dec 20, 2016
@jeremy jeremy added a commit to jeremy/mail that referenced this pull request Dec 20, 2016
@johngrimes @jeremy johngrimes + jeremy Decode UTF-7 field values.
Implementation from Ruby stdlib Net::IMAP.

Closes #650.
98312d3
@jeremy jeremy referenced this pull request Dec 20, 2016
Merged

Decode UTF-7 field values. #1062

@jeremy jeremy added a commit to jeremy/mail that referenced this pull request Dec 20, 2016
@johngrimes @jeremy johngrimes + jeremy Decode UTF-7 field values.
Implementation from Ruby stdlib Net::IMAP.

Closes #650.
a13bf44
@jeremy jeremy closed this in #1062 Dec 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment