Hvala Dario!
Ovo je bila moja greška, tako da sad radi i bez regex-a. Datoteka je imala na početku BOM. Negdje na netu sam čitao, da ako želiš utf8, mora da bude ovako:
$stringUTF8 = "\xEF\xBB\xBF"; // koda za utf-8
fwrite($fhh, $stringUTF8);
fwrite($fhh, $podacii);
fclose($fhh)
A sad sam dao ovako i radi:
//$stringUTF8 = "\xEF\xBB\xBF"; // koda za utf-8
//fwrite($fhh, $stringUTF8);
fwrite($fhh, $podaci);
fclose($fhh)