using command
$ret = shell_exec($command); results in $ret being null when $command returns string containing non-ascii characters (papír), but it works when $command returns string without non-ascii characters
same happens when using exec or system
as $command i tried
'LANG=en_US.utf-8; python myapp.py '.escapeshellarg($in); 'python myapp.py '.escapeshellarg($in); results obviously depends on $in, but it works when $in contains non-ascii characters and script returns only ascii characters, so problem is with output not input in my opinion
#!/bin/bash STR="papír" echo $STRthen i run php -r "var_dump(shell_exec('./command 2>&1'));" which doesn't retrun null but (string(7) "papír "). NOTEphp -r "echo strlen( 'papír' );"will give 6 (the number of bytes).myapp.py > out.txtresults in UnicodeEncodeError.export PYTHONIOENCODING=UTF-8;before command