Closed alexv96 closed 1 year ago
hi, this kind of string is a quoted-printable-encoding (the ?Q? mean this) you can decode it with below code:
$subject = '=?iso-8859-1?Q?Jos=E9_Antonio_Valiencia?=';
var_dump(mb_decode_mimeheader (str_replace('_', ' ', $subject)));
The replace is required because in Q encoding mode, RFC 2047 encodes spaces as _ (Section 4.2).
Just as info, another encoding exist, is the "B" mode, is a base64 Encoding mode, also this case is handled by mb_decode_mimeheader below an example with same string of previous example encoded as base64:
$subject = '=?iso-8859-1?B?Sm9zw6kgQW50b25pbyBWYWxpZW5jaWE=?=';
var_dump(mb_decode_mimeheader($subject));
Hi @mdemori , that's interesting, do you know if those have to be handled separately or are they "included" within these functions?
Best regards,
Hi @Webklex
I would suggest to use the function iconv_mime_decode($subject), as this method will not only take care of the quoted printable encoding but also of the character set and encoding ...
See https://www.php.net/iconv_mime_decode for further information.
Kind regards Dominik
Please update to v5.1 and give it another try. If you are currently using an older version below v5.0, please read the breaking changes leading up to v5.1 before upgrading.
Best regards,
It has happened to me lately that when I receive emails from people who have accents in their name, these are not displayed properly and shows a long text, I attach a test image.