special character to csv in php -
here current way i'm doing generate csv file in php,
$path = $url . 'temp/' .$filename.'.csv'; fputcsv($fp, $heders, ","); foreach ($new_data $line) { fputcsv($fp, $line, ","); } fclose($fp);
here problem have,
this data have in data set,
brüel & kjæ, type 4226, s/n: 2433646
when generate csv file it's change this,
brüel & kjæ, type 4226, s/n: 2433646
i need same character csv. please me solve issue :(
try this, set utf-8 before getting result both mysqli query , header
1. $mysqli->set_charset("utf8");
and
2. header('content-type: application/csv'); header('content-disposition: attachment; filename=' . $filename); header("content-transfer-encoding: utf-8"); header('pragma: no-cache');
Comments
Post a Comment