I created a simple directory reading in PHP, but when I upload files with accents, they appear with strange characters and then I can not open those files.
How to correctly read the accent?
I've tried a lot of things changing to UTF8 in HTML, but so far nothing.
<?php
//diretorio
$base = 'files/';
$abreDir = ($_GET['dir'] != '' ? $_GET['dir'] : $base);
$openDir = dir($abreDir);
//voltar
$strrdir = strrpos(substr($abreDir,0,-1),'/');
$voltar = substr($abreDir,0,$strrdir+1);
$openDir = dir($abreDir);
while($arq = $openDir -> read()):
if($arq != '.' && $arq != '..'):
if(is_dir($abreDir.$arq)):
//pastas
echo'<li class="folders"><a href="discovirtual?dir='.$abreDir.$arq.'/">'.$arq.'</a></li>';
else:
//arquivos
echo'<li class="files"><a href="'.$abreDir.$arq.'">'.$arq.'</a></li>';
endif;
endif;
endwhile;
if($abreDir != $base):
echo '<a href="discovirtual?dir='. $voltar.'">Voltar</a>';
endif;
$openDir -> close();
?>