title: HtmlPurifier disformats input
body: <p>i try to get htmlpurifier to work with my code as following:</p>
  
  <pre><code>if(isset($_POST['selectors_data'])) {
   //$selectors_data = tep_db_prepare_input($_POST['selectors_data']);
   $selectors_data2 = $_POST['selectors_data'];
  
   $config = HTMLPurifier_Config::createDefault();
   $purifier = new HTMLPurifier($config);
   $selectors_data = $purifier-&gt;purify($selectors_data2);
  }
  </code></pre>
  
  <p>i try to insert (<strong>newvalue</strong>): <code>&lt;i class="fa fa-angellist"&gt;&lt;/i&gt;</code></p>
  
  <p><em>on my localhost all magic quotes and references to magic quotes are turned off</em></p>
  
  <p>When data is saved (via jQuery $.post )</p>
  
  <pre><code>$.post('ajax_editor.php', {
          action: 'update',
          selectors_id: id,
          selectors_field: field,
          selectors_data: newvalue
      }, function (data) {
  
          $(' #container ').html(data);
  
      }, "json");
  </code></pre>
  
  <p>Via the following query the data is told to insert:</p>
  
  <pre><code>tep_db_query("update " . TABLE_BTS_CSS_SELECTORS . " set selectors_name = '" . $selectors_data . "' where selectors_id = '" . (int)$selectors_id . "'");
  </code></pre>
  
  <p>And via the following db function the data is actually inserted:</p>
  
  <pre><code>function tep_db_query($query, $link = 'db_link') {
  global $$link;
  
  $result = mysqli_query($$link, $query) or tep_db_error($query, mysqli_errno($$link), mysqli_error($$link));
  
  return $result;
  }
  </code></pre>
  
  <p>So, nothing is replaced/stripped/removed in the whole process except with htmlpurifier
  But the data is stored as:</p>
  
  <pre><code>&lt;i class=""fa"&gt;&lt;/i&gt;
  </code></pre>
  
  <p>I am out of options.</p>
  
  <p>As my site is in utf-8 i also tried:</p>
  
  <pre><code> $purifier = new HTMLPurifier();
   $selectors_data = $purifier-&gt;purify($selectors_data2);
  </code></pre>
  
  <p>So without config</p>
  
  <p>When i test on the <a href="http://bit.ly/1wduwH3" rel="nofollow">Htmlpurifier(click to see attempt)</a> demo site , all seems fine.</p>
  
  <p>UPDATE: i am now 100% sure the issue is NOT created by HTMLpurifier.There seems to be some hidden unknown code that converts <code>$_POST</code> statements (sorry)</p>
  
  <p><strong>SOLVED</strong> found the "hidden code as:</p>
  
  <pre><code>    // handle magic_quotes_gpc turned off.
    if (!get_magic_quotes_gpc()) {
      do_magic_quotes_gpc($HTTP_GET_VARS);
      do_magic_quotes_gpc($HTTP_POST_VARS);
      do_magic_quotes_gpc($HTTP_COOKIE_VARS);
    }
  </code></pre>
  
  <p>Where ofcourse for each $_GPC or $HTTP_GPC slashes are add.
  so a SIMPLE <code>stripslashes($_POST['selectors_data'])</code> BEFORE HTMLPurifier let it work :)</p>
  
  <p>Sorry for the big post</p>