title: PHP shell_exec failed due to some specific character
body: <p>I'm using <code>shell_exec</code> function to call <code>mailx</code> command on Ubuntu to send mail, but received error as there is specific character in the command, please see my below code and result.</p>
  
  <pre><code>&lt;?php
  $stringA="Visit STAR WARS™";
  $stringB="Visit STAR WARS";
  
  echo "StringA:", $stringA, "&lt;br/&gt;";
  $res = shell_exec("echo $stringA | mailx -s 'testA' my_email_address@mail.com");
  echo $res, "&lt;br/&gt;";
  
  echo "StringB:", $stringB, "&lt;br/&gt;";
  $res = shell_exec("echo $stringB | mailx -s 'testB' my_email_address@mail.com");
  echo $res, "&lt;br/&gt;";
  </code></pre>
  
  <p>When I call this page on the server, I got below page:</p>
  
  <pre><code>StringA: Visit STAR WARS™
  "/var/www/dead.letter" 1/19 
  StringB: Visit STAR WARS
  </code></pre>
  
  <p>and I received the mail with content <code>Visit STAR WARS</code>, and cannot received the mail with content <code>Visit STAR WARS™</code>.</p>
  
  <p>I checked from the phpinfo function, and the default_charset is "utf-8".
  if i run the command <code>"echo Visit STAR WARS™ | mailx -s 'testB' my_email_address@mail.com"</code>directly on the Ubuntu shell, I can get the mail with **™**content.</p>
  
  <p>Can anyone help me to fix the problem so that shell_exec function can send mail with specific characters.</p>