I have this php script:
<?php
$cmd_desformat = "/usr/local/bin/process /tmp/input.txt > /tmp/output.txt";
shell_exec($cmd_desformat);
Where input.txt is a UTF-8 file (checked with "file -i") containing:
Buenos días
and /usr/local/bin/process is a binary executable from a third party which I have extensively used and never got this problem.
Well, problem is that when I execute this from a browser:
http://localhost/test.php
The result output.txt is an US-ASCII file containing:
Buenos d?as [][
However, when I execute this from command line:
php test.php
The result output.txt is an UTF-8 file with the expected:
Buenos días [][
I have tried to execute from command line with user www-data to see if I could replicate the browser behaviour, but the result is again the correct one. I have also tried to use exec instead of shell_exec but the results are the same. Also tried with Firefox and Chrome.
I need it to work when being called from the browser. Any ideas?
bin/processsensitive to the environment locales…?