If I’m parsing an inbound email via php, and the address (through php) looks something like this:
=?UTF-8?B?5rWL6K+V5Zyw5Z2A?= <æµè¯å°å@server.tld>
And it’s supposed to actually look something like this:
测试地址 <测试地址@server.tld>
Any idea how I could quickly convert from one to the other? Might be staring me right in the face, but regardless, not quite seeing it at the moment.
Regarding where this is occurring. Basically, assuming an arbitrary email is sent to a catch-all handled via a php script, the php script, on execution, reads the to header of this email:
$a = imap_open({inbox}FOO,[username],[password]);
$x = [mail index];
$headers = imap_header($a,$x);
$data = $headers->toaddress;
$data is what I’m concerned with.
try this:–
see this url-
PHP decode GB2312
https://www.php.net/manual/en/function.iconv-mime-decode-headers.php
A better way to convert would be to use iconv, see http://www.php.net/iconv — example:
Above would echo out the given variable in ISO-8859-1 encoding, you may replace it with whatever you prefer.
another solution