PHP file_put_contents and UTF-8
<p>I have script that reads remote file content and writes it to local server. File contains characters: ąčęėįšųūž. After data insertion into local file, UTF-8 encoding is lost.
My script code:</p>

<pre><code>&lt;?php 

$data = file_get_contents('remote_file_address');

echo $data; //encoding is ok

$file = dirname(__FILE__) . '/../downloads/data.csv';

file_put_contents($file,$data); //invalid encoding in data.csv file

?&gt;
</code></pre>

<p>I also followed the instructions depending this post(<a href="http://stackoverflow.com/questions/4839402/how-to-write-file-in-utf-8-format">How to write file in UTF-8 format?</a>), but still no good.</p>

<p>So what is wrong with that? Any ideas?</p>
