From 7745b3565cbe16ae405f03beaf8dc1c9386a80e1 Mon Sep 17 00:00:00 2001 From: Jose Carlos Laura Ramirez Date: Mon, 9 Sep 2024 17:48:18 -0400 Subject: [PATCH] 2024.09.09-nimble-neem-hotfix-2024-09-29 Co-authored-by: Limber Mamani <154026979+LimberHope@users.noreply.github.com> --- app/Exports/V2/BaseExportFormSubmission.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/Exports/V2/BaseExportFormSubmission.php b/app/Exports/V2/BaseExportFormSubmission.php index 7a4697fb2..43a4b0df4 100644 --- a/app/Exports/V2/BaseExportFormSubmission.php +++ b/app/Exports/V2/BaseExportFormSubmission.php @@ -102,13 +102,21 @@ protected function getAnswer(array $field, array $answers): string return $this->stringifyModel($answer, ['first_name', 'last_name', 'title', 'gender', 'percent_ownership', 'year_of_birth',]); default: - $utf8Answer = mb_convert_encoding($answer, 'UTF-8', mb_detect_encoding($answer)); + if (is_string($answer)) { + $utf8Answer = mb_convert_encoding($answer, 'UTF-8', mb_detect_encoding($answer)); + } else { + $utf8Answer = $answer; + } return json_encode($utf8Answer, JSON_UNESCAPED_UNICODE); } } - $utf8Answer = mb_convert_encoding($answer, 'UTF-8', mb_detect_encoding($answer)); + if (is_string($answer)) { + $utf8Answer = mb_convert_encoding($answer, 'UTF-8', mb_detect_encoding($answer)); + } else { + $utf8Answer = $answer; + } return json_encode($utf8Answer, JSON_UNESCAPED_UNICODE); }