I have detect my value to write is Thai language and I will write to CSV file but when I use fwrite
and save .CSV file and open this CSV file in Excel.I see my text about "เธฅเธนเธเธเธฅเธดเนเธ,เธชเธฃเนเธฒเธเธฅเธฒเธข" Below this code
$xfile =fopen($filename,"w");
foreach( $data as $itm ){
$outstr="";
foreach($itm as $key=>$str){
$val =str_replace("\r\n","",$str);
val =str_replace("\t\t","",$val);
$val =str_replace('"',"'",$val);
$outstr=$outstr.'"'.$val.'"'.$clm;
//dump(mb_detect_encoding($outstr));die(); --Result UTF-8
}
$outstr=substr($outstr,0,strlen($outstr)-1);
fwrite($xfile,$outstr."\r\n"); //Newline
fclose($xfile);
I feel stupid Or i forgot something. Please help