From c59fdd1cf6b3e9a12d7ab4d5c35fc384013ec65a Mon Sep 17 00:00:00 2001 From: Patrick Janser Date: Tue, 6 May 2025 15:56:42 +0200 Subject: [PATCH] Fix `Lfm::translateFromUtf8()` to handle an array of strings and not only a string --- src/Lfm.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Lfm.php b/src/Lfm.php index 2094f159..55a85434 100644 --- a/src/Lfm.php +++ b/src/Lfm.php @@ -226,15 +226,21 @@ public function allowShareFolder() } /** - * Translate file name to make it compatible on Windows. + * Translate file or directory name(s) to be compatible on Windows. * - * @param string $input Any string. - * @return string + * @param string|array $input Any string or array of strings. + * @return string|array */ public function translateFromUtf8($input) { if ($this->isRunningOnWindows()) { - $input = iconv('UTF-8', mb_detect_encoding($input), $input); + if (is_array($input)) { + foreach ($input as &$item) { + $item = iconv('UTF-8', mb_detect_encoding($item), $item); + } + } else { + $input = iconv('UTF-8', mb_detect_encoding($input), $input); + } } return $input;