title: str_replace PHP script can't handle foreign characters such as umlauts robustly
body: <p>The following script does not always correctly catch and convert foreign characters. Could someone show me what I'm missing to get it to be more robust?</p>
  
  <pre><code>&lt;?php
  include("../index_head.inc.php");
  $content = implode("",(@file("current.txt")));
  
  $url = "http://XXXXXX.html?no_body=1";
  $content = file_get_contents($url,'r');
  
  if (isset($_GET['showcurrent']) &amp;&amp; $_GET['showcurrent'] == '')
      {
      $content = substr($content,1,strpos($content,"&lt;hr ")-1);
      }
      else 
      {
      $content = str_replace("&lt;br style=\"clear:both\" /&gt;\n&lt;/p&gt;", "&lt;/p&gt;",$content);   
      $content = str_replace("ck1\"&gt;&lt;img", "ck1\" target=_blank&gt;&lt;img",$content);  
      };
  
  $content = str_replace("&lt;h3&gt;current&lt;/h3&gt;", "",$content);
  
  echo "&lt;div id=\"service\" style=\"width: 660px;padding-left:5px\"&gt;",str_replace("current.html","current.html",$content),"&lt;/div&gt;";
  
  include("../index_footer.inc.php");
  ?&gt;
  </code></pre>
  
  <p>New information: Pekka, you gave me the idea to check how the page emits without str_replace():</p>
  
  <pre><code>&lt;?php
  include("../index_head.inc.php");
  $content = implode("",(@file("current.txt")));
  $url = "XXXXXX.html?no_body=1";
  $content = file_get_contents($url,'r');
  echo "&lt;div id=\"service\" style=\"width: 660px;padding-left:5px\"&gt;",$content,"&lt;/div&gt;";
  </code></pre>
  
  <p>It seems the problem lies elsewhere because I get the same mangling even <strong>without</strong> using str_replace()! If you can help me get this sorted out, I would sure appreciate it. I have seen your wish list. ;)</p>