#35674 [Opn->Bgs]: imap_8bit splits multibyte characters between lines

From: Date: Thu, 15 Dec 2005 00:28:59 +0000
Subject: #35674 [Opn->Bgs]: imap_8bit splits multibyte characters between lines
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-90448@lists.php.net to get a copy of this message
ID: 35674 Updated by: tony2001@php.net Reported By: kavol at email dot cz -Status: Open +Status: Bogus Bug Type: IMAP related Operating System: FreeBSD PHP Version: 4.4.1 New Comment: imap_8bit() is just a wrapper for IMAP c-client function. If it works in a wrong way - there is nothing PHP can do about it. Previous Comments: ------------------------------------------------------------------------ [2005-12-15 01:07:33] kavol at email dot cz 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 this bug report at http://bugs.php.net/?id=35674&edit=1

« previous php.bugs (#90448) next »