Lost-Photos-Found icon indicating copy to clipboard operation
Lost-Photos-Found copied to clipboard

Handle headers with multiple encodings

Open cmatsuoka opened this issue 8 years ago • 4 comments

It came to my attention that email.header.decode_header() returns a list of (string, encoding) pairs and our _charset_decoder function was handling only the first pair in this list. This was especially visible when decoding headers such as "=?Windows-1252?Q?Mauricio_Sim=F5es?= bla@bla" where the email address, which was decoded in the second pair, was lost in the final converted string.

Iterate over the list pairs and convert them separately to address this issue.

27/11 update: Additional commits deal with cosmetic changes to address pylint warnings, vim indent helpers to prevent mixing tabs and spaces, and a fix for mixed tabs and spaces.

cmatsuoka avatar Nov 25 '16 21:11 cmatsuoka

Shouldn't these new commits be in a separate PR? :-X

caiobegotti avatar Nov 28 '16 11:11 caiobegotti

They should, but apparently Github shoves them into the previous one. I guess you'll have to pull selectively from the command line.

cmatsuoka avatar Nov 28 '16 11:11 cmatsuoka

Hmm isn't it because you are re-using an old branch for these commits instead of a new one?

caiobegotti avatar Nov 28 '16 11:11 caiobegotti

It could be, I'm developing in master.

cmatsuoka avatar Nov 28 '16 12:11 cmatsuoka