diff --git a/lib/settings-common.php b/lib/settings-common.php index a3e0140..7f401e5 100644 --- a/lib/settings-common.php +++ b/lib/settings-common.php @@ -139,13 +139,15 @@ function toUTF8noBOM($string,$message) { if (0 === strncmp($string, $bom, 3)) { // If there's a BOM followed by a Windows based (2 char) line ending // chop BOM off and prefix returned string with a PHP_EOL - if (0 === strncmp($string, $bom."\r\n", 5)) { + if (0 === strncmp($string, $bom."\r\n", 3)) { $string = PHP_EOL.substr($string, 3); // Else, simply chop off the BOM } else { $string = substr($string, 3); } } + // Remove any other BOMs from view + $string = preg_replace('/\x{EF}\x{BB}\x{BF}/','',$string); // Test for any bad characters $teststring = $string;