title: Special characters parsing (ü,ä, etc). Works on localhost, not http
body: <p>I'm running a string of text against a body of text to determine if the string of text exists within a specific context (in this case, inside h2 heading tags). I can take an example and it works perfectly on a localhost installation of my app, running PHP 5.3 on Win 7 with XAMPP</p>
  
  <p>However, when I test this same content on a live http site, running PHP 5.3.8 on HostGator, I'm getting a false negative on the same test.</p>
  
  <p>Any ideas? Code is below...</p>
  
  <pre><code>Keyword: Flirttipps für Männer
  
  Content: &lt;h2&gt;Flirttipps für Männer&lt;/h2&gt;
  
  
  function doTheParse($heading='h2', $post) {
      //$content = $post-&gt;post_content;
      $content = '&lt;h2&gt;Flirttipps für Männer&lt;/h2&gt;';
      $keyword = sanitize_string( trim(strtolower(getKeyword($post))) );
      $keyword = sanitize2($keyword);
      @$dom = new DOMDocument;
      @$dom-&gt;loadHTML(sanitize_string( strtolower($content) ));
      $xPath = new DOMXPath(@$dom);
      switch ($heading) {
          case "img-alt": 
              return $xPath-&gt;evaluate('boolean(//img[contains(@alt, "'.$keyword.'")])');
          default: 
              return $xPath-&gt;evaluate('boolean(/html/body//'.$heading.'[contains(.,"'.$keyword.'")])');
      }
  }
  
  function getKeyword($post) {
      global $spec;
      $myKeyword = get_post_meta($post-&gt;ID, 'my_keyword', true);
      if(isset($spec['keyword_default']) &amp;&amp; $myKeyword == ""){$myKeyword = $post-&gt;post_title;}
      $myKeyword = htmlspecialchars_decode($myKeyword);
      return " ".$myKeyword;
  }
  
  function sanitize_string( $content ) {
      $regex = '/( [\x00-\x7F] | [\xC0-\xDF][\x80-\xBF] | [\xE0-\xEF][\x80-\xBF]{2} | [\xF0-\xF7][\x80-\xBF]{3} ) | ./x';
      return preg_replace($regex, '$1', $content);
  }
  
  function sanitize2($s) {
      $result = preg_replace("/[^\p{Latin}0-9&amp;'-]+/u", " ", html_entity_decode($s, ENT_QUOTES));
      return $result;
  }
  </code></pre>