// build iconv function
//http://monowx.blog.me/110084374548
if(!function_exists('iconv')) {
function iconv($from, $to, $text) {
$tmp_from = $_SERVER['DOCUMENT_ROOT'].'/temp/iconv_from';
$tmp_to = $_SERVER['DOCUMENT_ROOT'].'/temp/iconv_to';
$iconv_path = "/usr/bin/iconv";
if(file_exists($tmp_from)) {
@unlink($tmp_from);
}
if(file_exists($tmp_to)) {
@unlink($tmp_to);
}
$open_from = fopen($tmp_from, "w");
fwrite($open_from, $text);
fclose($open_from);
exec($iconv_path." -f ".$from." -t ".$to." ".$tmp_from." > ".$tmp_to);
$oepn_to = fopen($tmp_to, "a+");
$text = @fread($oepn_to, filesize($tmp_to));
fclose($oepn_to);
unlink($tmp_from);
unlink($tmp_to);
return $text;
}
}