[New-bugs-announce] [issue38621] Bad decoding of encoded-words in unstructured email headers

Fred Drake report at bugs.python.org
Mon Oct 28 12:47:43 EDT 2019


New submission from Fred Drake <fdrake at gmail.com>:

I've encountered a problem parsing an email with this Subject: header:

Subject: Be sure to redeem your =?utf-8?Q?$?=201.71 credit card reward
 certificate by the end of the year

email._header_value_parser.get_unstructured defers to get_encoded_word, passing the argument

  '=?utf-8?Q?$?=201.71 credit card reward certificate by the end of the year'

get_encoded_word eventually calls email._encoded_words.decode with the argument

  '=?utf-8?Q?$?=201.71 credit card reward certificate by the end of the year?='

This doesn't seem right, but I'm unsure of the syntactic priority of =XX and ?= in this case.

The policy for this is email.policy.SMTP + email.policy.strict (not sure if that's ideal; I'm retrieving messages from mbox files and over IMAP).

----------
assignee: r.david.murray
messages: 355564
nosy: barry, fdrake, r.david.murray
priority: normal
severity: normal
status: open
title: Bad decoding of encoded-words in unstructured email headers

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38621>
_______________________________________


More information about the New-bugs-announce mailing list