file to utf8
function readfile2utf8($filename) { $content = file_get_contents($filename); // return mb_convert_encoding($content, 'UTF-8', // mb_detect_encoding($content, 'UTF-8, ISO-8859-1', true)); return iconv(mb_detect_encoding($content, mb_detect_order(), true), "UTF-8", $content); }