Bug in displaying non-unicode messages

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Bug in displaying non-unicode messages

Martin Ng
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

Regards,
Martin

--
 
Martin Ng, MSc  |  Engineering Manager
"we love what we do"
www.avalade.com | Google+ | facebook
avalade group limited  |  marketing management technology
26C, MG Tower, 133 Hoi Bun Road, Kowloon, Hong Kong
Tel: +852 8212 0181  |  Fax: +852 8212 0183

Disclaimer: This transmission and the information it contains, including any attachment, is intended solely for the named recipient(s). It is confidential and the unauthorized use, disclosure or copying of this transmission or such information is prohibited. If you are not the/a recipient, and are in possession of this transmission (or any copy) without the consent of any named recipient, please notify the originator immediately and delete the transmission (including any attachment) and its contents.

------------------------------------------------------------------------------
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: [hidden email]
List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bug in displaying non-unicode messages

Martin Ng
Hi,

I think it is due to the wrong value in my config.php:
$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

Regards,
Martin

--
 
Martin Ng, MSc  |  Engineering Manager
"we love what we do"
www.avalade.com | Google+ | facebook
avalade group limited  |  marketing management technology
26C, MG Tower, 133 Hoi Bun Road, Kowloon, Hong Kong
Tel: +852 8212 0181  |  Fax: +852 8212 0183

Disclaimer: This transmission and the information it contains, including any attachment, is intended solely for the named recipient(s). It is confidential and the unauthorized use, disclosure or copying of this transmission or such information is prohibited. If you are not the/a recipient, and are in possession of this transmission (or any copy) without the consent of any named recipient, please notify the originator immediately and delete the transmission (including any attachment) and its contents.

--
 
Martin Ng, MSc  |  Engineering Manager
"we love what we do"
www.avalade.com | Google+ | facebook
avalade group limited  |  marketing management technology
26C, MG Tower, 133 Hoi Bun Road, Kowloon, Hong Kong
Tel: +852 8212 0181  |  Fax: +852 8212 0183

Disclaimer: This transmission and the information it contains, including any attachment, is intended solely for the named recipient(s). It is confidential and the unauthorized use, disclosure or copying of this transmission or such information is prohibited. If you are not the/a recipient, and are in possession of this transmission (or any copy) without the consent of any named recipient, please notify the originator immediately and delete the transmission (including any attachment) and its contents.

------------------------------------------------------------------------------
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: [hidden email]
List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bug in displaying non-unicode messages

Paul Lesniewski
On Thu, Dec 19, 2013 at 10:43 PM, Martin Ng <[hidden email]> 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: [hidden email]
List archives: http://news.gmane.org/gmane.mail.squirrelmail.devel
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-devel
Loading...