Html entities like € is not converted to its symbol in CSV conversion

前端 未结 6 601
别跟我提以往
别跟我提以往 2021-01-19 16:13

I have used CSV parser from http://code.google.com/p/parsecsv-for-php/, to export my reports to CSV in PHP. I have displayed Sales Total value in €XXXX.XX

6条回答
  •  一个人的身影
    2021-01-19 16:40

    According to me Excel has some problems displaying CSV-files with unicode characters.You can try once below :

    use fputcsv() with utf-8 handling.

    something like below :

    $handler = fopen("php://output", "w");
    
    header("Content-Type: text/csv; charset=UTF-8");
    fputcsv($handler, $fields, ';', '"');
    
    fclose($handler);
    

    Note php://output is a write-only stream that allows you to write to the output buffer mechanism in the same way as print() and echo().

提交回复
热议问题