Bug #62462 [Opn->Fbk]: quoted_printable_encode splits line in the middle of UTF8 character
| From: | stas@php.net | Date: | Sun, 15 Jul 2012 02:31:30 +0000 |
| Subject: | Bug #62462 [Opn->Fbk]: quoted_printable_encode splits line in the middle of UTF8 character | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-171962@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62462&edit=1
ID: 62462
Updated by: stas@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