shell_exec php with accent

Asked

Viewed 167 times

2

I need to rotate a command via shell which can have accent (involves filename) by PHP. Printing the command and rotating it in the hand it runs with the accent, but with the shell_exec it does not rotate. If I remove the seat from the file name it rotates the right command with the shell_exec, but I really can’t change the file name.

<?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();
?>

1 answer

3


I created a virtual machine with Ubuntu and threw it all in. I changed my ways and everything and it worked. I did it knowing that Linux treats accentuation differently.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.