Paul Smith writes:
At 12:29 03/12/2007, you wrote:
Paul Smith wrote:
How do you think you should parse this header according to RFC 2822?
From: Joe \(Joseph\) Bloggs <joe(_at_)joe(_dot_)com>
My view is why are you parsing the display name?
To display in an email client.
In a somewhat similar case, I first do real 822 parsing, then if that
fails, I scan for "@", and from each "@" left and right until I hit
",", EOL, BOL, "<" or ">". If I hit the right number of the right
things around each "@", and the localpart and domain seem sensible, I
assume that I've found all the email addresses in the header field and
disregard the display-names.
In case of the field you quote I'd probably end up displaying just
This fallback isn't perfect, but it's also not too complex and it finds
the significant data in a lot of bad header fields. And who cares,
really? If anyone really wants the display-name to be displayed, let
him/her encode it according to RFC 822.