====== SquirrelMail not displaying some subjects/messages ====== Got report after upgrade to Debian Jessie that SquirrelMail does not show messages using quoted-printable. http://sourceforge.net/p/squirrelmail/bugs/2806/ --- /usr/share/squirrelmail/functions/i18n.php.orig 2015-09-16 02:31:36.763732202 +0200 +++ /usr/share/squirrelmail/functions/i18n.php 2015-09-16 02:34:27.983563079 +0200 @@ -184,7 +184,7 @@ } /* All HTML special characters are 7 bit and can be replaced first */ - if (! $save_html) $string = sm_encode_html_special_chars ($string); + if (! $save_html) $string = sm_encode_html_special_chars($string, ENT_COMPAT, $charset); $charset = strtolower($charset); set_my_charset(); --- /usr/share/squirrelmail/functions/strings.php.orig 2015-09-16 02:34:52.320107664 +0200 +++ /usr/share/squirrelmail/functions/strings.php 2015-09-16 02:36:26.822222562 +0200 @@ -1496,6 +1496,24 @@ function sm_encode_html_special_chars($string, $flags=ENT_COMPAT, $encoding=NULL, $double_encode=TRUE) { + + static $htmlspecialchars_charsets = array( + 'iso-8859-1', 'iso8859-1', + 'iso-8859-5', 'iso8859-5', + 'iso-8859-15', 'iso8859-15', + 'utf-8', + 'cp866', 'ibm866', '866', + 'cp1251', 'windows-1251', 'win-1251', '1251', + 'cp1252', 'windows-1252', '1252', + 'koi8-R', 'koi8-ru', 'koi8r', + 'big5', '950', + 'gb2312', '936', + 'big5-hkscs', + 'shift_jis', 'sjis', 'sjis-win', 'cp932', '932', + 'euc-jp', 'eucjp', 'eucjp-win', + 'macroman', + ); + if (!$encoding) { global $default_charset; @@ -1504,6 +1522,17 @@ $encoding = $default_charset; } + if (!in_array(strtolower($encoding), $htmlspecialchars_charsets)) + { + // use default from configuration if provided or hard-coded fallback + // + global $default_htmlspecialchars_encoding; + if (!empty($default_htmlspecialchars_encoding)) + $encoding = $default_htmlspecialchars_encoding; + else + $encoding = 'iso-8859-1'; + } + if (check_php_version(5, 2, 3)) return htmlspecialchars($string, $flags, $encoding, $double_encode); No idea what it does and if this is ever going to be mainlined.