Read UTF-8 Lines of Text and Write them to File
<p>I fetch lines of UTF-8 text from a page then dump into a file. The text in the original page appears fine. However, the text in the output file appears scrambled!</p>

<p><strong>My attempt:</strong></p>

<pre><code>$myFile = "testFile.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$pageContent = file_get_contents("page.html");
//Here: use regex to grab the title ...
$stringData = $title."\n";
fwrite($fh, utf8_encode($stringData));
fclose($fh);
</code></pre>

<p>Before writing anything to the file. I saved the file as UTF-8 and i also saved it as Unicode, i still get scrambled text as:</p>

<blockquote>
  <p>ÊãäíÇÊí ááÌãíÚ</p>
</blockquote>

<p>I'm not using PHP5</p>

<p><strong>Any help will be appreciated...</strong></p>
