From 3bde305e77195ce1655fe66f9911cfc57a8e4021 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Fri, 17 Apr 2009 02:47:30 -0400
Subject: [PATCH] - Fix UTF-8 byte-order mark removing (#1485514)

---
 CHANGELOG                   |    1 +
 program/steps/mail/func.inc |    4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 0e0dce2..f04e628 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG RoundCube Webmail
 ===========================
 
+- Fix UTF-8 byte-order mark removing (#1485514)
 - Fix folders subscribtions on Konqueror (#1484841) 
 - Fix debug console on Konqueror and Safari
 - Fix messagelist focus issue when modifying status of selected messages (#1485807)
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index f9d560a..8931cfa 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -660,7 +660,7 @@
     '/<title>.*<\/title>/i',		// PHP bug #32547 workaround: remove title tag
     '/<html[^>]*>/im',			// malformed html: remove html tags (#1485139)
     '/<\/html>/i',			// malformed html: remove html tags (#1485139)
-    '/^[\xFE\xFF\xBB\xBF\x00]+((?:<\!doctype|\<html))/im',	// remove byte-order mark (only outlook?)
+    '/^(\0\0\xFE\xFF|\xFF\xFE\0\0|\xFE\xFF|\xFF\xFE|\xEF\xBB\xBF)/',	// byte-order mark (only outlook?)
   );
   $html_replace = array(
     '\\1'.' &nbsp; '.'\\3',
@@ -669,7 +669,7 @@
     '',
     '',
     '',
-    '\\1',
+    '',
   );
   $html = preg_replace($html_search, $html_replace, $html);
 

--
Gitblit v1.9.1