0
Guys I have the routine below that makes the listing of files from a directory:
if (is_dir($dir)) {
$dh = opendir($dir);
while (($file = readdir($dh)) !== false) {
if (!in_array($file, array(".", ".."))) {
$html->NOMEARQ = utf8_encode($file);
$html->DATAARQ = date("d/m/Y", filemtime($dir . $file));
$html->TAMANHO = fGetNumero(filesize($dir . $file) / 1000) . " KB";
$html->LINKARQ = "/arquivos/arquivos.download?p=docs&f=" . utf8_encode($file);
$html->block("BLOCK_LISTAGEM");
$qtdarq++;
}
}
closedir($dh);
}
It turns out that my development machine is Windows10 with Apache, and the Server is Ubuntu with Apache, on my machine it normally reads the filenames with special characters, Action is etc...
But when I put in production on Ubuntu/Apache I have to remove the utf8_encode function otherwise it messes up the whole file name.
I know this is because windows and linux treat different file names seems to me that windows uses ANSI and Linux UTF8.
There is a way to handle this without having to modify my PHP code when placing it on the server?
I can’t modify file names, remove accents and the like.
Our guy has to do this check, because only setting with UTF-8 does not work... this Meeting thing sucks, rsrsrs
– Marcelo