function removeBOM($str=""){
if(substr($str, 0,3) == pack("CCC",0xef,0xbb,0xbf)) {
$str=substr($str, 3);
}
return $str;
}
$text = "проверочный текст";
$bezbom = removeBOM(iconv("windows-1252","utf-8",$text));
$fp = fopen("iconv.txt","w");
fwrite($fp,$bezbom);
fclose($fp);