title: Not all eligible encoding using htmlentities
body: <p>I am using PHP 5.3.6 and and using HTML entities to encode some POST data. However, parenthesis and % are not encoding to their equivalent entity.</p>
  
  <p>We have been told by the web security team that these characters must be encoded as they could potentially be used in a XSS attack.</p>
  
  <p>Data being posted:</p>
  
  <pre><code>paren ( ) &amp; % won't encode
  </code></pre>
  
  <p><code>htmlentities($_POST['first_name'], ENT_QUOTES, "UTF-8");</code></p>
  
  <p>output:</p>
  
  <pre><code>paren ( ) &amp;amp; % won&amp;#039;t encode
  </code></pre>
  
  <p>As you can see the ( ) % are untouched.</p>
  
  <p>Thanks in advance.</p>
  
  <p>-EDIT-
  This is what I ended up using which did the job. Thanks.<br></p>
  
  <pre><code>function stripcustomchars($encode_chars) {  
      $searches = array('%','(',')');  
      $replacements = array("&amp;#37;","&amp;#40;","&amp;#41;");  
      $encoded = str_replace($searches, $replacements,$encode_chars);  
      return $encoded;
  }
  </code></pre>