From fde4e79ed0b851d0b7edfb44c0630cbf385f83cc Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 4 May 2023 19:48:09 +0200 Subject: SQL attributes native unicode (#5371) Save our attributes for entries, feeds, and tags as native Unicode instead of JSON escape sequences such as `\u00f8` which are difficult to work with. --- app/Models/CategoryDAO.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/Models/CategoryDAO.php') diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php index 98d45733c..e89ceb773 100644 --- a/app/Models/CategoryDAO.php +++ b/app/Models/CategoryDAO.php @@ -60,7 +60,7 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo { continue; } if (!($stm->bindValue(':id', $feed['id'], PDO::PARAM_INT) && - $stm->bindValue(':attributes', json_encode($attributes, JSON_UNESCAPED_SLASHES)) && + $stm->bindValue(':attributes', json_encode($attributes, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)) && $stm->execute())) { Minz_Log::error('SQL error ' . __METHOD__ . json_encode($stm->errorInfo())); } @@ -118,7 +118,7 @@ SQL; $values = array( $valuesTmp['kind'] ?? FreshRSS_Category::KIND_NORMAL, $valuesTmp['name'], - is_string($valuesTmp['attributes']) ? $valuesTmp['attributes'] : json_encode($valuesTmp['attributes'], JSON_UNESCAPED_SLASHES), + is_string($valuesTmp['attributes']) ? $valuesTmp['attributes'] : json_encode($valuesTmp['attributes'], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), $valuesTmp['name'], ); @@ -169,7 +169,7 @@ SQL; $values = array( $valuesTmp['name'], $valuesTmp['kind'] ?? FreshRSS_Category::KIND_NORMAL, - is_string($valuesTmp['attributes']) ? $valuesTmp['attributes'] : json_encode($valuesTmp['attributes'], JSON_UNESCAPED_SLASHES), + is_string($valuesTmp['attributes']) ? $valuesTmp['attributes'] : json_encode($valuesTmp['attributes'], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), $id, $valuesTmp['name'], ); -- cgit v1.2.3