diff --git a/public/legacy/include/utils.php b/public/legacy/include/utils.php index 4f8f3f9435..524303bfec 100755 --- a/public/legacy/include/utils.php +++ b/public/legacy/include/utils.php @@ -2804,7 +2804,9 @@ function purify_html(?string $value, array $extraOptions = []): string { $sanitizer = new SuiteCRM\HtmlSanitizer($extraOptions); - $cleanedValue = htmlentities($sanitizer->clean($value, true)); + //htmlentities destroys multi-byte characters : https://stackoverflow.com/questions/5679715/htmlentities-destroys-utf-8-strings + //$cleanedValue = htmlentities($sanitizer->clean($value, true)); + $cleanedValue=htmlspecialchars($sanitizer->clean($value, true), ENT_QUOTES); $decoded = html_entity_decode($cleanedValue); $doubleDecoded = html_entity_decode($decoded); @@ -2812,7 +2814,8 @@ function purify_html(?string $value, array $extraOptions = []): string { $doubleDecoded = ''; } - $doubleCleanedValue = htmlentities($sanitizer->clean($doubleDecoded, true)); + //$doubleCleanedValue = htmlentities($sanitizer->clean($doubleDecoded, true)); + $doubleCleanedValue = htmlspecialchars($sanitizer->clean($doubleDecoded, true), ENT_QUOTES); return $doubleCleanedValue; }