squirrelmail blanks entire lines of text when characters with accent are found
"Giuseppe Ciaccio" <[email protected]> Sun, 31 Aug 2014 11:55:17 +0200
| Newsgroups | gmane.mail.squirrelmail.internationalization |
|---|---|
| Message-ID | <[email protected]> |
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 [email protected] 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: [email protected] List archives: http://news.gmane.org/gmane.mail.squirrelmail.internationalization List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-i18n