forked from wallabag/wallabag
Fix UTF-8 encoding before JSON export
This commit is contained in:
@ -908,7 +908,7 @@ class Poche
|
|||||||
$entries = $this->store->retrieveAllWithTags($this->user->getId());
|
$entries = $this->store->retrieveAllWithTags($this->user->getId());
|
||||||
if ($entries) {
|
if ($entries) {
|
||||||
echo $this->tpl->render('export.twig', array(
|
echo $this->tpl->render('export.twig', array(
|
||||||
'export' => Tools::renderJson($entries),
|
'export' => Tools::renderJson(Tools::utf8ize($entries)),
|
||||||
));
|
));
|
||||||
Tools::logm('export view');
|
Tools::logm('export view');
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -232,6 +232,27 @@ final class Tools
|
|||||||
exit();
|
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
|
* Create new line in log file
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user