I hit a weird problem with the default PHP 5.1.6 on CentoS 5.2.
It seems the default 5.1.6 PHP on CentOS has a bug in the functions escapeshellargs/escapeshellcmd: it "gulps" any special (non-ASCII) characters, so that they are missing from the output. I have been assured that this does not happen on other 5.1.6 or newer on other Linux distributions. I don't see this behavior with the exact same $LANG setting (en_US.UTF8) on CentOS 4. Moreover the behavior is different when running the script via console or webserver. If I run on console with my $LANG setting of en_US.UTF8 I get correct output if the input is UTF-8 (which is still incorrect, if the encoding doesn't match it should output garbage and not "nothing"). Via webserver I still get no output with the same characters and encoding of the page set to UTF-8. Could others check on what they have available (other PHP, other distributions) and tell the results?
a test page: <? $test = "äöüÄÖÜß"; print $test; print "<br>\n"; print escapeshellarg($test); print "<br>\n"; $test = "äöüÃÃÃÃ"; print $test; print "<br>\n"; print escapeshellarg($test); ?>
It will output German umlauts in ISO-8859-1 and UTF-8. Depending on your $LANG setting and the coding set to the webpage you may either get some correct characters or garbage between ''. The main point is that the respective output for lines 1 and 2 and for lines 3 and 4 should be *identical* with the exception of the outer single quotes. The function is supposed to escape single quotes and do nothing else with the input (e.g. output "as is"). If the output is only '', then there is a bug.
Kai