From da935d004ede312da44713863eaa908fabf8c60e Mon Sep 17 00:00:00 2001 From: Valentin Hristov Date: Wed, 20 Jun 2018 10:59:05 +0300 Subject: [PATCH] fix(api): timeperiod API response without HTML encoding (#6380) Resolve CP7M-105 Ref #6359 --- www/api/class/centreon_configuration_timeperiod.class.php | 2 +- www/api/class/webService.class.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/www/api/class/centreon_configuration_timeperiod.class.php b/www/api/class/centreon_configuration_timeperiod.class.php index 22546150d8c..81f27ed56e2 100644 --- a/www/api/class/centreon_configuration_timeperiod.class.php +++ b/www/api/class/centreon_configuration_timeperiod.class.php @@ -83,7 +83,7 @@ public function getList() while ($data = $stmt->fetch()) { $timePeriodList[] = array( 'id' => $data['tp_id'], - 'text' => $data['tp_name'] + 'text' => html_entity_decode($data['tp_name']), ); } return array( diff --git a/www/api/class/webService.class.php b/www/api/class/webService.class.php index 36147556a3a..c56d079dc02 100644 --- a/www/api/class/webService.class.php +++ b/www/api/class/webService.class.php @@ -222,8 +222,8 @@ public static function sendResult($data, $code = 200, $format = null) break; case static::RESULT_JSON: case null: - header('Content-type: application/json'); - print json_encode($data); + header('Content-type: application/json;charset=utf-8'); + print json_encode($data, JSON_UNESCAPED_UNICODE); break; }