Preserve unicode characters in goals_criteria JSON encoding for department goals

This commit is contained in:
Jeppe Bundgaard
2026-01-27 07:51:58 +01:00
parent edbd7f539c
commit f5e715d113
@@ -114,8 +114,8 @@ class departmentGoalsRoute
}
}
// Parse criteria
$criteria = goals_criteria::fromJson(json_encode($criteriaInput));
// Parse criteria (preserve unicode characters like æ, ø, å)
$criteria = goals_criteria::fromJson(json_encode($criteriaInput, JSON_UNESCAPED_UNICODE));
// Create
$goal = (new department_goals_o())->add($user, $departments, $criteria);
@@ -185,7 +185,8 @@ class departmentGoalsRoute
if ($response->isRequestParameterSet('criteria')) {
$criteriaInput = self::getParameter('criteria');
$this->requireTypeIn($criteriaInput, ['array', 'object']);
$criteria = goals_criteria::fromJson(json_encode($criteriaInput));
// Preserve unicode characters when (re)encoding criteria
$criteria = goals_criteria::fromJson(json_encode($criteriaInput, JSON_UNESCAPED_UNICODE));
$dataToUpdate['criteria'] = $criteria->toArray();
}