From 7672a10776136842906e4f34e3ced0d7286f1c4a Mon Sep 17 00:00:00 2001 From: Ymage Date: Thu, 7 Apr 2016 22:35:37 +0200 Subject: Apply utf8_encode only on unrecognized encoded string --- inc/poche/Tools.class.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index 3f68cff5..2ee86c74 100755 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php @@ -237,18 +237,25 @@ final class Tools * * @param $data */ - public static function utf8ize($data) + public static function utf8ize($data) { - if (is_array($data)) + if (is_array($data)) { - foreach ($data as $k => $v) + foreach ($data as $k => $v) { $data[$k] = self::utf8ize($v); } } - else if (is_string ($data)) + else if (is_string ($data)) { - return utf8_encode($data); + if ('' == mb_detect_encoding($data)) + { + return utf8_encode($data); + } + else + { + return $data; + } } return $data; } -- cgit v1.2.3