php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35674 imap_8bit splits multibyte characters between lines
Submitted: 2005-12-15 01:07 UTC Modified: 2005-12-15 01:28 UTC
From: kavol at email dot cz Assigned:
Status: Not a bug Package: IMAP related
PHP Version: 4.4.1 OS: FreeBSD
Private report: No CVE-ID: None
 [2005-12-15 01:07 UTC] 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  

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-15 01:28 UTC] tony2001@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 19:01:29 2024 UTC