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

Bug #20226 Mail_mimePart::encodeHeader does not encode ISO-2022-JP string.
Submitted: 2014-03-21 05:36 UTC Modified: 2014-05-14 09:01 UTC
From: zhk72mtq Assigned: alec
Status: Closed Package: Mail_Mime (version 1.8.8)
PHP Version: 5.5.10 OS: Windows 8 64bit
Roadmaps: (Not assigned)    
Subscription  


 [2014-03-21 05:36 UTC] zhk72mtq (Atsushi Suzuki)
Description: ------------ Mail_mimePart#encodeHeader and Mail_mime#headers does not encode ISO-2022-JP (or other 7bit encodings possibly) string but returns raw string. In mimePart.php, whether the value needs conversion or not is determined by existence of non-ascii character. however, since ISO-2022-JP is 7bit encoding, that should be determined by existence of non-ascii printable character. Test script: --------------- <?php require_once('Mail/mimePart.php'); // precondition assert(mb_internal_encoding() === 'UTF-8'); assert(mb_detect_encoding(file_get_contents(__FILE__)) === 'UTF-8'); $encoding = 'ISO-2022-JP'; $text = '????'; $mime = new Mail_mimePart(); $subject = $mime->encodeHeader( 'Subject', mb_convert_encoding($text, $encoding), $encoding, 'base64'); var_dump($subject); Expected result: ---------------- string(38): "'=?ISO-2022-JP?B?GyRCJT8lJCVIJWsbKEI=?=" Actual result: -------------- string(14): "?$B%?%$%H%k?(B"

Comments

 [2014-03-21 06:49 UTC] zhk72mtq (Atsushi Suzuki)
 [2014-03-21 06:50 UTC] zhk72mtq (Atsushi Suzuki)
 [2014-03-22 08:44 UTC] doconnor (Daniel O'Connor)
 [2014-03-22 08:44 UTC] doconnor (Daniel O'Connor)
-Status: Open +Status: Analyzed
 [2014-03-22 08:44 UTC] doconnor (Daniel O'Connor)
Any chance of a test case, and forking + updating the PR?
 [2014-05-14 09:01 UTC] alec (Aleksander Machniak)
-Status: Analyzed +Status: Closed -Assigned To: +Assigned To: alec
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.