PHP Convert UNICODE to UTF-8

This is post is now quite old and the the information it contains may be out of date or innacurate.

If you find any errors or have any suggestions to update the information please let us know or create a pull request on GitHub

If you are struggling with a UNICODE file in your PHP scripts and aren’t ready or able to make the jump to PHP5.3 then this little snippet might help you out:

$converted = dirname(__FILE__).'/converted.txt';
$source= dirname(__FILE__).'/source.txt';
shell_exec("iconv -o $conv  -f UNICODE -t UTF-8 -V $converted");

Its using the Linux iconv command. Of course it requires you to be running on Linux.