Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/Lfm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down