squirrelmail blanks entire lines of text when characters with accent are found

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

squirrelmail blanks entire lines of text when characters with accent are found

Giuseppe Ciaccio
Hello,

I've manually installed squirrelmail 1.4.22, with no plugins
PHP 5.4.30
GNU/Linux Slackware 14.1
Apache 2.4.6
imapd 2.11
sendmail 8.14.9

Problem: when reading emails containing italian letters with accent, those
line of text containing said chars are made blank without notice (very
annoying!).

I've tracked down the bug into the source code,
file funtions/i18n.php, function charset_decode(), around line 187:

<CODE-SNIPPET>

/* All HTML special characters are 7 bit and can be replaced first */
if (! $save_html) $string = htmlspecialchars ($string);
$charset = strtolower($charset);

set_my_charset();

</CODE-SNIPPET>

The htmlspecialchars(), without any argument specifying the charset encoding,
will return a blank string if encountering a letter with accent, treating them
as invalid code unit sequences.

A possible solution that works for me, is to replace the above code with this
one:

<CODE-SNIPPET>

$charset = strtolower($charset);
set_my_charset();

/* All HTML special characters are 7 bit and can be replaced first */
if (! $save_html) $string = htmlspecialchars ($string, ENT_SUBSTITUTE,$charset);

</CODE-SNIPPET>

This way, all chars that have an encoding in the $charset are treated as
regular ones.

The ENT_SUBSTITUTE is just to prevent blanking, should the htmlspecialchar()
fail -- I prefer to see a line of text with "weird" sequences rather than a
blank line.


Giuseppe Ciaccio                http://www.disi.unige.it/person/CiaccioG/
DIBRIS - Universita' di Genova  via Dodecaneso 35   16146 Genova,   Italy
[hidden email]       phone +390103536663     fax +390103536699
-------------------------------------------------------------------------

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
-----
squirrelmail-i18n mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
Information about translations: http://squirrelmail.org/wiki/LanguageTranslation
Statistics for translations: http://l10n-stats.squirrelmail.org/
List address: [hidden email]
List archives: http://news.gmane.org/gmane.mail.squirrelmail.internationalization
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-i18n
Reply | Threaded
Open this post in threaded view
|

Re: squirrelmail blanks entire lines of text when characters with accent are found

Paul Lesniewski
On 8/31/14, Giuseppe Ciaccio <[hidden email]> wrote:

> Hello,
>
> I've manually installed squirrelmail 1.4.22, with no plugins
> PHP 5.4.30
> GNU/Linux Slackware 14.1
> Apache 2.4.6
> imapd 2.11
> sendmail 8.14.9
>
> Problem: when reading emails containing italian letters with accent, those
> line of text containing said chars are made blank without notice (very
> annoying!).

As is mentioned on the SquirrelMail home page, there are fixes for
this in testing.  You should install a 1.4.23 snapshot and take a look
at the newest patch from here:

https://sourceforge.net/p/squirrelmail/bugs/2806/

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

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
-----
squirrelmail-i18n mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
Information about translations: http://squirrelmail.org/wiki/LanguageTranslation
Statistics for translations: http://l10n-stats.squirrelmail.org/
List address: [hidden email]
List archives: http://news.gmane.org/gmane.mail.squirrelmail.internationalization
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-i18n