]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - inc/poche/Tools.class.php
Fix UTF-8 encoding before JSON export
[github/wallabag/wallabag.git] / inc / poche / Tools.class.php
index e5e150cdb7d8f3bce3c7633c675a1d403215858a..d84850cf739e36f9631d30ec99967f9e666cc81b 100755 (executable)
@@ -232,6 +232,27 @@ final class Tools
         exit();
     }
 
+    /**
+     * UTF-8 encode array of string
+     *
+     * @param $data
+     */
+    public static function utf8ize($data) 
+    {
+       if (is_array($data)) 
+        {
+            foreach ($data as $k => $v) 
+            {
+                $data[$k] = self::utf8ize($v);
+            }
+        }
+        else if (is_string ($data)) 
+        {
+            return utf8_encode($data);
+        }
+        return $data;
+    }
+
     /**
      * Create new line in log file
      *