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

Julian Espérat savageman86 at gmail.com
Thu Mar 12 19:37:04 UTC 2020


Several header classes are using  \Horde_Mime::decode(), but not the
addresses classes.

This works:

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

On Thu, Mar 12, 2020 at 7:49 PM Jan Schneider <jan at horde.org> wrote:

>
> Zitat von Julian Espérat <savageman86 at gmail.com>:
>
> > 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
>
> We use PHP's internal quoted_printable_decode() function for decoding
> this, so there isn't much Horde can do about this broken string.
>
> --
> Jan Schneider
> The Horde Project
> https://www.horde.org/
>
> --
> dev mailing list
> Frequently Asked Questions: http://wiki.horde.org/FAQ
> To unsubscribe, mail: dev-unsubscribe at lists.horde.org
>


More information about the dev mailing list