I'm building a website on a linux server which can provide some informations about mkv file using mkvmerge command line but i'm facing a big issue when using the command $info = shell_exec("mkvmerge -J '".$chemin_fichier."'");
when the output of the command line contains accents, the output is being truncated :
exptected output :
{
"container": {
"properties": {
"is_providing_timestamps": true,
"title": "Le Bel Été 2019"
},
"type": "Matroska"
}
}
actual output :
{
"container": {
"properties": {
"is_providing_timestamps": true,
"title": "Le Bel
I did find on the web that we needed to modify the language of the environnement [using putenv() and setlocale() ] which i did but it didn t work. But i can define some variables using accents so this is quite strange.
anyway, when i run the same file on my computer using wamp server, or the same command line in my linux server terminal, i'm getting the correct output so i think the problem come from php(7.3) or apache(2.4).
do you have any idea ? Feel free to ask for extra details :)
Ok so i figured it out !
actually, the language "fr_FR.utf8" does not work for accents and special characters while "en_US.utf8" seems to be the only solution.
The default language on my server was POSIX which does not allow accents neither.
to make things work, place the following lines in your php script
$locale = 'en_US.utf8';
setlocale(LC_ALL, $locale);
putenv('LC_ALL='.$locale);