[dev] Error parsing this To: field (potentially invalid?)

Julian Espérat savageman86 at gmail.com
Fri Feb 28 09:19:53 UTC 2020


Hi there,

I am parsing emails, and I have one particular example that gives me
an empty "To" header where I believe it should (could?) work.

Here's the minimal sample to reproduce:

echo (string) (new \Horde_Mime_Headers_Addresses('To',
'"A=?utf-8?Q?Name=22?= <email at gmail.com>')); // empty string (expected: "A
name <email at gmail.com>")

The recipient display name is enclosed in quotes: the first quote is
not encoded, but the 2nd one is contained within an utf8-encoded
portion (before anyone asks: in my minimal sample, it doesn't make
sense to have this utf8-encoded portion, but it does in the email I'm
parsing).

The cause may well be a buggy email client that messed up the encoding
and did it badly, but it would also probably be nice to handle this
edge-case into the Horde libraries?

Thanks for reading,
-Julian


More information about the dev mailing list