Converting ob_get_clean results in PHP
<p>I am working on an existing php site, and it has an export page which spits out data and is saved into text documents. (txt &amp; xtg)</p>

<pre><code>$output = ob_get_clean();
</code></pre>

<p>The problem I'm trying to fix is the encoding of the output, apparently the charcters are not displaying correctly. I'm pretty sure the database is in the correct UTF-8 format.</p>

<p>The issues show up like this <code>La FÃ©dÃ©ration</code></p>

<p>I tried the following, but it didn't work - the output is still wrong - any ideas ?</p>

<pre><code>$output = mb_convert_encoding($output, "UTF-8");
</code></pre>

<p>this is the rest of the relevant code</p>

<pre><code>// Ouput file.
// Set DOS line endings for Quark 6
file_put_contents( "/var/www/vhosts/artsdb.net/httpdocs/export/" . $type . "/" . $filename . ".xtg.txt", str_replace( array( "\n", "\r\n\r\n" ), array( "\r\n", "\r\n" ), $output ) );

echo "Exporting " . str_replace( "_", " ", $filename ) . " ($type) complete.\n\n";
</code></pre>

<p>Thanks for looking</p>
