summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2009-10-22 18:37:00 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2009-10-22 18:37:00 +0000
commit60fefb9649608247fbbf3dacb82987f1c6a7f745 (patch)
tree78747ebc2ee0b103feb47af9482a42bfb3398ddc
parent12e387e68fab8da3428fb21200e5a225b384ddf2 (diff)
- fix rc_utf8_clean() on Windows (#1486232)
git-svn-id: https://svn.roundcube.net/trunk@3052 208e9e7b-5314-0410-a742-e7e81cd9613c
-rw-r--r--roundcubemail/CHANGELOG2
-rw-r--r--roundcubemail/program/include/rcube_shared.inc11
2 files changed, 8 insertions, 5 deletions
diff --git a/roundcubemail/CHANGELOG b/roundcubemail/CHANGELOG
index 02e6a4c60..dc2957228 100644
--- a/roundcubemail/CHANGELOG
+++ b/roundcubemail/CHANGELOG
@@ -3,7 +3,7 @@ CHANGELOG RoundCube Webmail
- Added server-side e-mail address validation with 'email_dns_check' option (#1485857)
- Fix login page loading into an iframe when session expires (#1485952)
-- added option 'force_https_port' in 'force_https' plugin (#1486091)
+- Allow setting port number in 'force_https' option (#1486091)
- Option 'force_https' replaced by 'force_https' plugin
- Fix IE issue with non-UTF-8 characters in AJAX response (#1486159)
- Partially fixed "empty body" issue by showing raw body of malformed message (#1486166)
diff --git a/roundcubemail/program/include/rcube_shared.inc b/roundcubemail/program/include/rcube_shared.inc
index d60291012..97314ccd1 100644
--- a/roundcubemail/program/include/rcube_shared.inc
+++ b/roundcubemail/program/include/rcube_shared.inc
@@ -599,12 +599,15 @@ function rc_utf8_clean($input)
return $input;
}
- if (!is_string($input))
+ if (!is_string($input) || $input == '')
return $input;
- // iconv is 10x faster
- if (function_exists('iconv'))
- return iconv('UTF8', 'UTF8//IGNORE', $input);
+ // iconv/mbstring are much faster (especially with long strings)
+ if (function_exists('mb_convert_encoding') && ($res = mb_convert_encoding($input, 'UTF8', 'UTF8')))
+ return $res;
+
+ if (function_exists('iconv') && ($res = iconv('UTF8', 'UTF8//IGNORE', $input)))
+ return $res;
$regexp = '/^('.
// '[\x00-\x7F]'. // UTF8-1