#35674 [NEW]: imap_8bit splits multibyte characters between lines

From: Date: Thu, 15 Dec 2005 00:07:35 +0000
Subject: #35674 [NEW]: imap_8bit splits multibyte characters between lines
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-90447@lists.php.net to get a copy of this message
From: kavol at email dot cz Operating system: FreeBSD PHP version: 4.4.1 PHP Bug Type: IMAP related Bug description: imap_8bit splits multibyte characters between lines Description: ------------ Hello, if the function imap_8bit reaches the maximum length for a line, it splits the line regardless if the last triplet is the last one of a series or if it is only a beginning of a multibyte character ... I consider this behaviour to be a little bit problematic ... this does not directly violate the RFC 2045, but, reading it carefully: WARNING TO IMPLEMENTORS: If binary data is encoded in quoted-printable, care must be taken to encode CR and LF characters as "=0D" and "=0A", respectively. In particular, a CRLF sequence in binary data should be encoded as "=0D=0A". Otherwise, if CRLF were represented as a hard line break, it might be incorrectly decoded on platforms with different line break conventions. - the "spirit" of the RFC2045 says that sequences with exact meaning (as indivisible sequences) should be encoded together The only problem is, how the function should know that it should take care of specific encoding instead of working with separate 8bit chars ... locale? a parameter? p.s. the string within the code should be encoded in UTF-8, it is taken from a real world problem ... it was on PHP 4.4.0 (I chose the closest pick), but it behaves the same on 5.0.4 too p.p.s. sorry for my English :-) Reproduce code: --------------- <?php echo (imap_8bit ("SN: Upozorn&#283;ní na novou akci - Váno&#269;ní Jablko&#328;")); ?> Expected result: ---------------- SN: Upozorn=C4=9Bn=C3=AD na novou akci - V=C3=A1no=C4=8Dn=C3=AD Jablko= =C5=88 Actual result: -------------- SN: Upozorn=C4=9Bn=C3=AD na novou akci - V=C3=A1no=C4=8Dn=C3=AD Jablko=C5= =88 -- Edit bug report at http://bugs.php.net/?id=35674&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35674&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35674&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35674&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=35674&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=35674&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=35674&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=35674&r=needscript Try newer version: http://bugs.php.net/fix.php?id=35674&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=35674&r=support Expected behavior: http://bugs.php.net/fix.php?id=35674&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=35674&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=35674&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=35674&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=35674&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=35674&r=dst IIS Stability: http://bugs.php.net/fix.php?id=35674&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=35674&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=35674&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=35674&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=35674&r=mysqlcfg

« previous php.bugs (#90447) next »