Change param and remove all other BOMs

This commit is contained in:
Matt Pass
2016-05-05 15:55:55 +01:00
parent af318dd703
commit 191990ffdb

View File

@@ -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;