shell_exec php with accent

1

I need to run a command via shell which may have an accent (involves filename) by PHP. Printing the command and running it in hand it runs with the accent, but with shell_exec it does not run. If I take the accent from the file name it runs the right command with shell_exec , but I can not really rename the file.

<?php

    header("Content-Type: text/html; charset=ISO-8859-1",true);

    $path = "C:\Users\gabriela.mattos\Desktop\audios\";

    $diretorio = dir($path);
    while($arquivo = $diretorio -> read()){

       if ($arquivo != "." && $arquivo != ".."){
           $arquivo2= (utf8_encode($arquivo));

           $arquivo2 = str_replace(" ","_",$arquivo2);
           $arquivoConvertido = str_replace(".mp3",".avi",$arquivo2);

           echo shell_exec(utf8_encode("ffmpeg -loop 1 -y -i C:\Users\gabriela.mattos\Pictures\logo.jpg -i ".$path.$arquivo2." -shortest -acodec copy -vcodec mjpeg ".$path.$arquivoConvertido.""));
    }
}
$diretorio -> close();
?>
    
asked by anonymous 13.09.2018 / 20:46

1 answer

2

I created a virtual machine with ubuntu and threw everything there. I changed the ways and everything and it worked. I did this knowing that Linux treats the accent differently.

    
14.09.2018 / 15:29