Re: Bug in displaying non-unicode messages

Paul Lesniewski <[email protected]> Fri, 3 Jan 2014 00:35:11 -0800
Newsgroups gmane.mail.squirrelmail.devel
Message-ID <CAHog115k=Jsbim01eLC6jV+sWxtx41KqMNo06WCgR+0UtUmxXA@mail.gmail.com>
On Thu, Dec 19, 2013 at 10:43 PM, Martin Ng <[email protected]> wrote:
>
> Hi,
>
> I think it is due to the wrong value in my config.php:

1) Please don't top post
2) Please post in plain text only
3) Please search the mailing list archives before posting
4) See http://sourceforge.net/p/squirrelmail/bugs/2806
5) Thanks for your interest

> $default_charset       = 'iso-8859-1';
>
> After switching to utf-8, it is OK.
>
> Regards,
> Martin
>
>
> On 12/17/2013 12:53 PM, Martin Ng wrote:
>
> Hi,
>
> I found that the non-unicode messages cannot be displayed correctly in the latest SquirrelMail.
> The non-unicode subject line, attachment name, etc can't be displayed.
> It looks like this in one of our SquirrelMail installations:
>
> So the user is unable to read the message or download the attachment because of anchor text is missing.
>
> I've identified the code that causes the missing text.
> In functions/i18n.php (line 187):
>
> if (! $save_html) $string = htmlspecialchars ($string);
>
> The htmlspecialchars returns empty string since the $string variable contains non-UTF8 characters (say GB2312).
> This is explained in the PHP documentation at http://php.net/htmlspecialchars:
>
> If the input string passed to this function and the final document share the same character set, this function is sufficient to prepare input for inclusion in most contexts of an HTML document. If, however, the input can represent characters that are not coded in the final document character set and you wish to retain those characters (as numeric or named entities), both this function and htmlentities() (which only encodes substrings that have named entity equivalents) may be insufficient. You may have to use mb_encode_numericentity() instead.
>
> Currently, I've commented it out as a workaround.
> But I think this code should be fixed officially. I don't know why htmlspecialchars is needed there, but I think it was added on purpose.
>
> SquirrelMail version: 1.4.22
> Every plugin installed: built-in plugins
> PHP version: 5.4.23
> Web server: 2.2.16
> IMAP server: Qmail installed via http://qmailrocks.thibs.com
> SMTP server: Qmail installed via http://qmailrocks.thibs.com
> OS: Debian Squeeze
> How your software was installed, including the package name if applicable: squirrelmail-webmail-1.4.22.zip and squirrelmail-decode-1.2.zip
> Browsers tried: Firefox 25.0.1

-- 
Paul Lesniewski
SquirrelMail Team
Please support Open Source Software by donating to SquirrelMail!
http://squirrelmail.org/donate_paul_lesniewski.php

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&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