codemator Posted May 18, 2009 Share Posted May 18, 2009 Hello All I have a problem when trying to export date(in Czech) to CSV Here is the code i am using header("Content-type: application/force-download"); header('Content-Disposition: inline; filename="resultaat.csv"'); header("Content-Transfer-Encoding: Binary"); header("Content-length: ".strlen($sExcel)); header('Content-Type: charset=utf-8'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="resultaat.csv"');* for($i=0;$i<count($pom);$i++){ $out .= $pom[$i]['msisdn'] ; $out .= ","; $out .= fixEncoding($pom[$i]['last']); $out .= ","; $out .= fixEncoding($pom[$i]['first']); $out .="\r\n"; } echo $out; function fixEncoding($in_str) { $cur_encoding = mb_detect_encoding($in_str) ; if($cur_encoding == "UTF-8") return $in_str; else return utf8_encode($in_str); } Please help me out ??? Link to comment https://forums.phpfreaks.com/topic/158559-export-to-csv-encoding-problem/ Share on other sites More sharing options...
Masna Posted May 18, 2009 Share Posted May 18, 2009 Well, why are you trying to encode everything with UTF-8? Is that the correct encoding for Czech? Link to comment https://forums.phpfreaks.com/topic/158559-export-to-csv-encoding-problem/#findComment-836270 Share on other sites More sharing options...
codemator Posted May 18, 2009 Author Share Posted May 18, 2009 BUT UTF-8 is working if i print it to browser, Is there any thing wrong in doing that? Link to comment https://forums.phpfreaks.com/topic/158559-export-to-csv-encoding-problem/#findComment-836450 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.