From: Paul L. <pa...@sq...> - 2013-10-24 23:45:59
|
神部さん、おひさしぶりです。 On Thu, Oct 24, 2013 at 4:26 AM, Takahiro Kambe <ta...@ba...> wrote: > Hi, > > This isn't a bug report but a simple question. > > In src/compose.php, body of a message is passed to decodeHeader(). > Why $body is passed to decodeHeader()? I'm not certain. Marc introduced it long, long ago: http://sourceforge.net/p/squirrelmail/code/4565/ If you look at the code around there, a few things that aren't headers (such as $signature) are being passed to decodeHeader() so it may have been a safety mechanism to catch values of many different strings that were possibly encoded. > SM-1_4-STABLE: about line 1316 of src/compose.php: > echo sm_encode_html_special_chars(decodeHeader($body,false,false,true)); > > trunk: about line 1398 of src/compose.php: > > $body_str = sm_encode_html_special_chars(decodeHeader($body,false,false)); > > There was a bad scenario. > > 1. Accidently (or intentionally) body text contains encoded MIME > header string such as "=?iso-2022-jp?B ...". I see. Although a quick test replying to a text/plain message in quoted-printable encoding seems to show that the message is already decoded by the time it gets here (thus it seems this decodeHeader() call isn't needed to convert the QP blocks/entities), I'm hesitant to touch this since there was presumably good reason for the change. If you want to remove all the calls to decodeHeader($body...) (I see at least three of them) and test for a while, your feedback would be welcomed. > 2. decodeHeader() decodes such ""=?iso-2022-jp?B ..." string into > iso-2022-jp (or other none UTF-8 string) encoded string. > > 3. Body is expected to UTF-8 or EUC-JP and really contain such string > in the encoding. > > 4. As a result, multiple text encopding are miexed and it cause > strange garbled characters. > > I hope $body should be already properly encoded and no need to decode > header any more at that time. -- Paul Lesniewski SquirrelMail Team Please support Open Source Software by donating to SquirrelMail! http://squirrelmail.org/donate_paul_lesniewski.php |