Forum Moderators: coopster
function getDirectoryListing($folder) {
$aryListing = array();
$dir = new RecursiveDirectoryIterator($folder, FilesystemIterator::SKIP_DOTS);
// Flatten the recursive iterator, folders come before their files
$it = new RecursiveIteratorIterator($dir, RecursiveIteratorIterator::SELF_FIRST);
foreach ($it as $fileinfo) {
if ($fileinfo->isFile()) {
$f = array();
$f['file'] = $fileinfo->getFilename();
$f['dir'] = "\\" . $it->getSubPath();
$f['pathfile'] = $it->getSubPathName();
$f['size'] = $fileinfo->getSize();
$f['size_human'] = bytesToHuman($fileinfo->getSize());
$f['time_mod'] = $fileinfo->getMTime();
$f['time_mod_full'] = date('F j, Y, g:i a', $fileinfo->getMTime());
$aryListing[] = $f;
} elseif ($fileinfo->isDir()) {
//print($fileinfo->__toString() . PHP_EOL);
} else {
// echo $fileinfo->getFilename(); // what
}
}
return $aryListing;
} This does not happen with all accented characters.That would be because the ones like é or ü or ñ are in Latin-1, while the examples from the previous paragraph (g-hacek and e-hacek *, looks like) aren’t, so the function “flattens” them to their diacritic-less form. Can your php function’s encoding be changed?
Are these user generated files? Just asking since you indicate that manually renaming is being done. Do the filtering/replacing in the upload script first. Not THE answer, but is AN answer.
Can your php function’s encoding be changed?
First step might be to step through the function and find out at exactly what point the accented characters are being “flattened”