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  

enter image description here

when generate csv file it's change this,

brüel & kjæ, type 4226, s/n: 2433646 

enter image description here

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

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -