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); }