From 6735caae362ff554ca7a3581a87cd99ea62d5156 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Tue, 26 Apr 2016 09:15:55 +0100 Subject: [PATCH] UTF8 BOM should be replaced with a PHP_EOL --- lib/settings-common.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/settings-common.php b/lib/settings-common.php index eee76d8..f2acb52 100644 --- a/lib/settings-common.php +++ b/lib/settings-common.php @@ -133,8 +133,9 @@ function toUTF8noBOM($string,$message) { // Attempt to detect encoding if (function_exists('mb_detect_encoding')) { $strictUTF8 = mb_detect_encoding($string, 'UTF-8', true); - // Get rid of any UTF-8 BOM - $string = preg_replace('/\x{EF}\x{BB}\x{BF}/','',$string); + // Get rid of any UTF-8 BOM, need to replace with a line return + $string = preg_replace("/\x{EF}\x{BB}\x{BF}/",PHP_EOL,$string); + // Test for any bad characters $teststring = $string; $teststringBroken = utf8_decode($teststring);