Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.6

Request #15960 PATCH: mimeDecode ignores character encoding/charset
Submitted: 2009-02-28 05:29 UTC
From: treyhyde Assigned:
Status: Feedback Package: Mail_mimeDecode
PHP Version: 5.2.8 OS: FreeBSD
Roadmaps: (Not assigned)    
Subscription  


 [2009-02-28 05:29 UTC] treyhyde (Trey Hyde)
Description: ------------ _decodeHeader ignores the charset portion of base64 encoded headers. Doing so will work for 8859, ANSI and other 7bit compatible charsets but not for GB* encoded Chinese or other similar "exotic" character sets. Similarly, it ignores the charset portion of content-type in the mime definition of bodies. This patch should do the same thing as it did before if iconv is not present and the correct thing if it is present. You'll want to make sure your iconv.*_encoding php.ini properties are set correctly or set them at run time with iconv_set_encoding Test script: --------------- Expected result: ---------------- Actual result: --------------

Comments

 [2009-03-02 03:30 UTC] doconnor (Daniel O'Connor)
Thanks for the patch Trey. Two quick ones: 1. cvs diff -u next time 2. Can you provide a small executable test case to prove your patch works.
 [2009-03-02 03:30 UTC] doconnor (Daniel O'Connor)
-Status: Open +Status: Feedback
 [2009-08-25 11:49 UTC] cweiske (Christian Weiske)
Wrote a mail to him asking for support.
 [2009-08-26 01:53 UTC] treyhyde (Trey Hyde)
I had it all ready back in March but at that time this bug system wasn't accepting my comments and there was no way to upload files that were not patches. Let me see what I can dig up. It was pretty easy to reproduce on any character set that wasn't 7bit compatible with ASCII.
 [2009-08-26 02:17 UTC] treyhyde (Trey Hyde)
test data: Message-Id: <2FE6A643-1B7A-46F0-A94A-D13A0CF5470F@centraldesktop.com> From: Trey Hyde To: folder.0.20919.general@in.th.centraldesktop-dev.com Content-Type: multipart/alternative; boundary=Apple-Mail-7-807266768 X-Smtp-Server: mail0.centraldesktop.com:thyde@centraldesktop.com Mime-Version: 1.0 (Apple Message framework v930.3) Subject: =?GB18030?B?pKrWqqTppLs=?= Date: Wed, 11 Mar 2009 16:01:44 -0700 --Apple-Mail-7-807266768 Content-Type: text/plain; charset=GB18030; format=flowed Content-Transfer-Encoding: base64 jI+Wy4ZUoaKls6XhpfOlxqlgpb+pYKTPNdTCNsjVpN6kx8S8vK+kt6TepLmhow0K05vKwqTOpail 86XIpeqpYKTPM9TCOMjVpKuk6TXUwjbI1aTepMekyKTKpOqk3qS5oaOKXqTDpMaktLLOvNOkr6TA pLWkpKGjDQoNCg0KDQpUcmV5IEh5ZGUNCnRoeWRlQGNlbnRyYWxkZXNrdG9wLmNvbQ0KQ2VudHJh bCBEZXNrdG9wLCBJbmMuDQpPcmdhbml6ZSwgU2hhcmUsIENvbGxhYm9yYXRlDQoNCg== --Apple-Mail-7-807266768 Content-Type: text/html; charset=GB18030 Content-Transfer-Encoding: quoted-printable
<br></body></html>= --Apple-Mail-7-807266768--
 [2009-08-26 02:19 UTC] treyhyde (Trey Hyde)
nm, I think I'm feeling my frustration with this system from March boil up again. It's munging all the encoded data. I'll email.
 [2009-08-26 11:41 UTC] cweiske (Christian Weiske)
-Status: Feedback +Status: Open
 [2009-08-26 11:41 UTC] cweiske (Christian Weiske)
I do have the demo code on my machine.
 [2011-09-05 14:20 UTC] alan_k (Alan Knowles)
Looking at this, the decoder returns information about the byte string, including what character set it uses. I think it should be the responsibility of the callee to do conversions on this data, Providing a helper method may be a viable option here. but doing the encoding in-line is error prone. and may lead to data being lost. Considering flagging as 'expected behaviour'
 [2011-09-05 14:20 UTC] alan_k (Alan Knowles)
-Status: Open +Status: Feedback -Type: Bug +Type: Feature/Change Request