Edit report at https://bugs.php.net/bug.php?id=62462&edit=1

 ID:                 62462
 Updated by:         s...@php.net
 Reported by:        c2h5oh at poczta dot fm
 Summary:            quoted_printable_encode splits line in the middle of
                     UTF8 character
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            *Mail Related
 Operating System:   Linux
 PHP Version:        5.3.14
 Block user comment: N
 Private report:     N

 New Comment:

Could you explain why soft line breaks is a problem? The software decoding the 
QP 
string should ignore the linebreaks and reassemble the string in the original 
form. Quoting from https://en.wikipedia.org/wiki/Quoted-printable:

A soft line break consists of an "=" at the end of an encoded line, and does 
not 
appear as a line break in the decoded text. 

So where the corruption of the utf-8 comes from?


Previous Comments:
------------------------------------------------------------------------
[2012-07-02 11:42:51] c2h5oh at poczta dot fm

Description:
------------
quoted_printable_encode adds, among other things, soft line breaks if line 
lenght 
is greater than 76 characters. 
If that 76th character happens to be in the middle if encoded UTF8 character 
then 
this character will be split into two lines corrupting the encoded sting.



Test script:
---------------
<?php
echo 
quoted_printable_encode('ąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąąą');

Expected result:
----------------
=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
=C4=85=C4=85=C4=85=C4=85=C4=85

Actual result:
--------------
=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=
=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=
=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=C4=85=
=C4=85=C4=85=C4=85


(compare ends of each line)


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=62462&edit=1

Reply via email to