From 3a431f08ca73becdf8c478314a10525e93f0cf04 Mon Sep 17 00:00:00 2001 From: GoryMoon Date: Sun, 26 Nov 2023 17:10:59 +0100 Subject: [PATCH 1/2] Fix #274 - Views Incorrectly Encode UTF Characters as HTML Entities --- public/legacy/include/utils/db_utils.php | 1 + 1 file changed, 1 insertion(+) diff --git a/public/legacy/include/utils/db_utils.php b/public/legacy/include/utils/db_utils.php index 984edcf2cb..7f29181ec4 100755 --- a/public/legacy/include/utils/db_utils.php +++ b/public/legacy/include/utils/db_utils.php @@ -72,6 +72,7 @@ function from_db_convert($string, $type) '>' => '>', "'" => ''', ); +$GLOBALS['toHTML'] = $toHTML; $GLOBALS['toHTML_keys'] = array_keys($toHTML); $GLOBALS['toHTML_values'] = array_values($toHTML); $GLOBALS['toHTML_keys_set'] = implode("", $GLOBALS['toHTML_keys']); From ff1ed1de23a73af7549ef540000137c2bafd5bcf Mon Sep 17 00:00:00 2001 From: "y.yerli" Date: Thu, 20 Jun 2024 16:14:21 +0300 Subject: [PATCH 2/2] Add html decoding on mappers --- .../PresetDataHandlers/HistoryTimelineDataHandler.php | 4 ++++ .../portability/ApiBeanMapper/TypeMappers/ParentMapper.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/core/backend/Data/LegacyHandler/PresetDataHandlers/HistoryTimelineDataHandler.php b/core/backend/Data/LegacyHandler/PresetDataHandlers/HistoryTimelineDataHandler.php index 7559106b68..b58ac7539b 100644 --- a/core/backend/Data/LegacyHandler/PresetDataHandlers/HistoryTimelineDataHandler.php +++ b/core/backend/Data/LegacyHandler/PresetDataHandlers/HistoryTimelineDataHandler.php @@ -322,6 +322,10 @@ public function fetch( $listData[$key]['assigned_user_name']['user_name'] = $user->user_name ?? ''; $listData[$key]['assigned_user_name']['user_id'] = $record['assigned_user_id']; $listData[$key]['module_name'] = $panelToModuleName[$listData[$key]['panel_name']]; + $listData[$key]['description'] = html_entity_decode($listData[$key]['description'] ?? '', ENT_QUOTES); + $listData[$key]['name'] = html_entity_decode($listData[$key]['name'] ?? '', ENT_QUOTES); + $listData[$key]['status'] = html_entity_decode($listData[$key]['status'] ?? '', ENT_QUOTES); + } $timelineEntryData = new ListData(); diff --git a/public/legacy/include/portability/ApiBeanMapper/TypeMappers/ParentMapper.php b/public/legacy/include/portability/ApiBeanMapper/TypeMappers/ParentMapper.php index 55cc4b8285..ae71a42705 100644 --- a/public/legacy/include/portability/ApiBeanMapper/TypeMappers/ParentMapper.php +++ b/public/legacy/include/portability/ApiBeanMapper/TypeMappers/ParentMapper.php @@ -83,7 +83,7 @@ public function toApi(SugarBean $bean, array &$container, string $name, string $ } $relate['id'] = $parentId; - $relate[$rName] = $bean->$name ?? ''; + $relate[$rName] = html_entity_decode($bean->$name ?? '', ENT_QUOTES); $container[$newName] = $relate; }