From aae5ae8aa2992aefc57220db45a21e4a3e194453 Mon Sep 17 00:00:00 2001 From: Mark Unwin Date: Fri, 15 Dec 2023 09:16:54 +1000 Subject: [PATCH] Stop using utf8_encode to avoid deprecation warning. --- app/Helpers/device_helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Helpers/device_helper.php b/app/Helpers/device_helper.php index 194d5cbd9..355fcec3b 100644 --- a/app/Helpers/device_helper.php +++ b/app/Helpers/device_helper.php @@ -22,7 +22,7 @@ function audit_convert(string $input) // See if we have stringified JSON $json = html_entity_decode($input); if (mb_detect_encoding($json) !== 'UTF-8') { - $json = utf8_encode($json); + $json = mb_convert_encoding($json, 'UTF-8', mb_list_encodings()); } $json = @json_decode($json); if ($json) { @@ -84,7 +84,7 @@ function audit_convert(string $input) } $xml = html_entity_decode($input); if (mb_detect_encoding($xml) !== 'UTF-8') { - $xml = utf8_encode($xml); + $xml = mb_convert_encoding($xml, 'UTF-8', mb_list_encodings()); } $xml = iconv('UTF-8', 'UTF-8//TRANSLIT', $xml); $xml = preg_replace('/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F]/u', '', $xml);