if(!function_exists(iconv))
{
$p = popen("which iconv", "r");
if($p)
{
$iconv_path = trim(fgets($p, 1024));
fclose($p);
$_checker = explode('/', $iconv_path);
if(($_checker[count($_checker)-1])=="iconv")
{
function iconv($from, $to, $text)
{
global $iconv_path;
$process = proc_open(
$iconv_path." --from-code=".$from." --to-code=".$to,
array(array("pipe", "r"),array("pipe", "w")),
$pipes
);
fwrite($pipes[0],$text);
fclose($pipes[0]);
$result = '';
while (!feof($pipes[1]))
$result .= fgets($pipes[1], 024);
fclose($pipes[1]);
proc_close($process);
return $result;
}
}
}
}