我刚刚在旧脚本中遇到错误(使用Zend 1):
This is part of an email:
--_008_AM2PR07MB0610CE26A6AB7483C300DDC0F4620AM2PR07MB0610eurp_
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document;
name="=?utf-8?B?VmVydHJhdWxpY2hrZWl0c2Vya2zDpHJ1bmdfTGllZmVyYW50ZW5fYmxhbmtv?=
=?utf-8?Q?.docx?="
Content-Description: =?utf-8?B?VmVydHJhdWxpY2hrZWl0c2Vya2zDpHJ1bmdfTGllZmVyYW50ZW5fYmxhbmtv?=
=?utf-8?Q?.docx?=
Content-Disposition: attachment;
filename="=?utf-8?B?VmVydHJhdWxpY2hrZWl0c2Vya2zDpHJ1bmdfTGllZmVyYW50ZW5fYmxhbmtv?=
=?utf-8?Q?.docx?="; size=29798;
creation-date="Wed, 10 Dec 2014 15:04:14 GMT";
modification-date="Wed, 10 Dec 2014 15:04:14 GMT"
Content-Transfer-Encoding: base64
但是我的代码失败了:
exception 'Zend_Mail_Exception' with message 'Invalid header value detected [application/vnd.openxmlformats-officedocument.wordprocessingml.document; name="Vertraulichkeitserklärung_Lieferanten_blanko.docx"]' in /usr/share/php/Zend/Mail/Header/HeaderValue.php:133
Stack trace:
#0 /usr/share/php/Zend/Mail/Part.php(600): Zend_Mail_Header_HeaderValue::assertValid('application/vnd...')
#1 /usr/share/php/Zend/Mail/Part.php(151): Zend_Mail_Part->_validateHeaders(Array)
#2 /usr/share/php/Zend/Mail/Part.php(289): Zend_Mail_Part->__construct(Array)
#3 /usr/share/php/Zend/Mail/Part.php(353): Zend_Mail_Part->_cacheContent()
#4 /root/gmail_backup/Searcher.php(241): Zend_Mail_Part->countParts()
正如您所看到的,该文件的名称带有特殊字符(ä)。
我怎么能说这个标题是正确的? (以便Zend_Mail_Header_HeaderValue :: isValid返回true而不是false?)
更新1:我的iconv.internal_encoding设置为ISO-8859-1,我现在将其设置为UTF-8。
谢谢!