电子邮件标题是iso-8859-1(如charset所指定),主题包含iso-8859字符:
...
Content-Transfer-Encoding: 7bit
Content-Type: multipart/mixed; boundary="_----------=_1446372573736206";
charset="iso-8859-1" // NOTICE: need this parameter to transform the subject to UTF-8
Disposition: attachment
MIME-Version: 1.0
Type: text/plain
Date: Sun, 1 Nov 2015 07:09:33 -0300
From: <coffe@tea.cl>
To: <lala@asdasd.cl>
Subject: Cigüeña hindú // NOTICE: special characters in iso-8859-1
X-Mailer: MIME::Lite 3.030 (F2.82; B3.13; Q3.13)
...
这是我到目前为止所做的:
$hostname = '{www.example.com/imap/novalidate-cert}INBOX';
$username = 'lala@asdasd.cl';
$password = 'dsadsadsa';
$imap_stream = imap_open($hostname, $username, $password);
$email_uids = imap_search($imap_stream, 'ALL');
$email_header = imap_header($imap_stream, $email_uid[0]);
echo imap_mime_header_decode($email_header -> subject)[0] -> text; // Cig�e�a hind�
我没有找到任何函数来使用imap扩展从头中获取charset参数。
如何使用imap扩展获取字符集?