Issue531205
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2002-03-18 05:13 by barry, last changed 2022-04-10 16:05 by admin. This issue is now closed.
Messages (8) | |||
---|---|---|---|
msg9745 - (view) | Author: Barry A. Warsaw (barry) * | Date: 2002-03-18 05:13 | |
This bug is in rfc822.parseaddr(), and thus inherited into email.Utils.parseaddr() since the latter does a straight include of the former. It has a nasty bug when the email address contains embedded spaces: it collapses the spaces: >>> from email.Utils import parseaddr >>> parseaddr('foo bar@wooz.org') ('', 'foobar@wooz.org') >>> parseaddr('<foo bar@wooz.org>') ('', 'foobar@wooz.org') Boo, hiss. Of course parseaddr() would be more involved to implement in an RFC 2822 compliant way, but it would be very cool. Note that I'm reporting this bug here instead of the mimelib project because it's actually in rfc822.py. Once solution might include fixing it in the email package only. |
|||
msg9746 - (view) | Author: Barry A. Warsaw (barry) * | Date: 2002-04-15 17:18 | |
Logged In: YES user_id=12800 Note further that "foo bar"@wooz.org is properly parsed. The question is, what should parseaddr() do in this non-compliant situation? I can think of a couple of things: - it could raise an exception - it could return ('', 'bar@wooz.org') - it could return ('foo', 'bar@wooz.org') - it could return ('' '"foo bar"@wooz.org') I'm not sure what the right thing to do is. I'm assigning to Ben Gertzfield to get his opinion. Ben, feel free to add a comment and re-assign the bug to me. |
|||
msg9747 - (view) | Author: Tim Roberts (timroberts) | Date: 2002-08-12 21:40 | |
Logged In: YES user_id=265762 Interesting to note that RFC 822 (but not 2822) allows spaces around any periods in the address without quoting (2822 does allow spaces around the @), and those spaces are to be removed. Section A.1.4 gives the example Wilt . Chamberlain@NBA.US and says it should be parsed as "Wilt.Chamberlain". Given that, it's hard for me to see that the current behavior should be changed at all, since there is no correct way to parse this non-compliant address. |
|||
msg9748 - (view) | Author: Johannes Gijsbers (jlgijsbers) * | Date: 2004-07-22 18:30 | |
Logged In: YES user_id=469548 Well, the docs say "unless the parse fails, in which case a 2-tuple of ('', '') is returned". I think it's reasonable to say that non-compliant addresses like this should fail to parse and thus that parseaddr('foo bar@wooz.org') should returns ('', '') |
|||
msg9749 - (view) | Author: Paul Moore (paul.moore) * | Date: 2004-11-08 20:49 | |
Logged In: YES user_id=113328 This issue still exists in Python 2.3.4 and Python 2.4b2. |
|||
msg9750 - (view) | Author: Facundo Batista (facundobatista) * | Date: 2004-11-25 01:29 | |
Logged In: YES user_id=752496 Reassigning it as a Py2.4 bug. |
|||
msg9751 - (view) | Author: Tony Meyer (anadelonbrin) | Date: 2005-01-30 23:43 | |
Logged In: YES user_id=552329 IMO, the current behaviour should be retained for the reasons outlined by Tim Roberts, or extra code should be added to strip spaces around periods and the @, and if there are others then ('', '') should be returned. The latter is probably more correct, but there doesn't seem to be any pressing reason for the former. As such, recommend closing "Won't fix". If the latter behaviour is desired, then I could work up a patch for it. |
|||
msg9752 - (view) | Author: Martin v. Löwis (loewis) * | Date: 2005-03-03 09:51 | |
Logged In: YES user_id=21627 I'm going to follow anadelonbrin's recommendation: the current behaviour is actually correct. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-10 16:05:06 | admin | set | github: 36271 |
2002-03-18 05:13:13 | barry | create |