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

Bug #7561 Mail_mimePart::_quotedPrintableEncode() misbehavior with mbstring overload
Submitted: 2006-05-05 09:23 UTC
From: php at diptyque dot net Assigned: cipri
Status: Closed Package: Mail_Mime (version 1.3.1)
PHP Version: Irrelevant OS: FreeBSD
Roadmaps: 1.4.0, 1.4.0a1    
Subscription  


 [2006-05-05 09:23 UTC] php at diptyque dot net (MichaĆ«l Guitton)
Description: ------------ Mail_mimePart::_quotedPrintableEncode() does not properly encode multi-byte characters when mbstring overload is enabled: it only encodes the first byte and skips any following byte(s) ; php.ini Multi-byte string setup mbstring.language = Neutral; (UTF-8) mbstring.func_overload = 6; see [1] mbstring.internal_encoding = UTF-8 mbstring.http_output = UTF-8 [1] (http://www.php.net/manual/en/ref.mbstring.php#mbstring.ove rload) Test script: --------------- =begin TEST <?php require_once 'Mail/mimePart.php'; // string is UTF-8 encoded $input = "Micha\xC3\xABl \xC3\x89ric St\xC3\xA9phane"; $rv = Mail_mimePart::_quotedPrintableEncode($input); echo $rv, "\n"; ?> =end TEST A multi-byte string agnostic patch: =begin DIFF diff -u mimePart.php.bak mimePart.php --- mimePart.php.bak Thu Jan 19 13:09:40 2006 +++ mimePart.php Tue Apr 25 11:19:34 2006 @@ -318,11 +318,12 @@ while(list(, $line) = each($lines)){ - $linlen = strlen($line); + $line = preg_split('//', $line, -1, PREG_SPLIT_NO_EMPTY); + $linlen = count($line); $newline = ''; for ($i = 0; $i < $linlen; $i++) { - $char = substr($line, $i, 1); + $char = $line[$i]; $dec = ord($char); if (($dec == 32) AND ($i == ($linlen - 1))){ // convert space at eol only =end DIFF Expected result: ---------------- Micha=C3=ABl =C3=89ric St=C3=A9phane Actual result: -------------- Micha=C3l =C3ric St=C3phane

Comments

 [2006-06-07 18:06 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2006-12-03 11:58 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2007-05-05 15:09 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!