I'm trying to export my .csv file with chinese character using PHP. Instead the data that I've after export is ??? for my chinese character, English character are just working fine. Please have a look on my code below and let me know where's the problem seems to be, Thank you.
PHP
$a = mysqli_query($db, "select * from remark_type where remark_code = ".$_POST["code"]."");
$getrow = mysqli_fetch_array($a);
header("Content-Encoding: UTF-8");
header('Content-type: application/csv;charset:UTF-8');
header('Content-Disposition: attachment; filename='.$getrow["title"]."_".$_POST["year"].'.csv');
echo "\xEF\xBB\xBF";
// data of my csv file code here
$file = fopen('php://output', 'w');
foreach ($newname as $line) {
if($_POST["method"] == 2)
fputcsv($file, $line);
else
{
fputcsv($file, $line);
}
}
fclose($file);
add this after fopen
Example