Fixed: recursively UTF-8 encode nested arrays, skip non-strings, and normalize ISO-8859-1 values to prevent CSV import errors

This commit is contained in:
Amit sharma
2026-04-04 14:39:28 +05:30
parent 8db3919ba1
commit aabb921d8d

View File

@@ -3224,11 +3224,23 @@ class AdminImportControllerCore extends AdminController
public function utf8EncodeArray($array)
{
if (is_array($array)) {
return array_map(function ($item) {
return mb_convert_encoding($item, 'UTF-8', 'ISO-8859-1');
return array_map(function ($value) {
if (is_array($value)) {
return $this->utf8EncodeArray($value);
}
if (!is_string($value)) {
return $value;
}
return mb_convert_encoding($value, 'UTF-8', 'ISO-8859-1');
}, $array);
}
if (!is_string($array)) {
return $array;
}
return mb_convert_encoding($array, 'UTF-8', 'ISO-8859-1');
}