From af8b3b649e9956fe15c98298faf6755c29edcf77 Mon Sep 17 00:00:00 2001 From: Ymage Date: Thu, 7 Apr 2016 22:49:15 +0200 Subject: Factorize --- inc/poche/Tools.class.php | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index 2ee86c74..263034f0 100755 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php @@ -239,23 +239,16 @@ final class Tools */ public static function utf8ize($data) { - if (is_array($data)) + if (is_array($data)) { foreach ($data as $k => $v) { $data[$k] = self::utf8ize($v); } } - else if (is_string ($data)) + else if (is_string ($data) && '' == mb_detect_encoding($data)) { - if ('' == mb_detect_encoding($data)) - { - return utf8_encode($data); - } - else - { - return $data; - } + return utf8_encode($data); } return $data; } -- cgit v1.2.3