Re: Process $body with decodeHeader()?
Paul Lesniewski <[email protected]> Thu, 24 Oct 2013 16:45:32 -0700
| Newsgroups | gmane.mail.squirrelmail.devel |
|---|---|
| Message-ID | <CAHog114WmSVjpuTw+2+pR2hLV=YEUt4kOP8wd+UY24b0eEub+w@mail.gmail.com> |
On Thu, Oct 24, 2013 at 4:26 AM, Takahiro Kambe <[email protected]> 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 ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk ----- squirrelmail-devel mailing list Posting guidelines: http://squirrelmail.org/postingguidelines List address: [email protected] List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel