2021年1月21日星期四

How can I set encoding for export csv with Laravel Excel in Laravel

I using Laravel Excel for export CSV file in Laravel. How can I set the encoding for export csv file.

I have tried several ways:

  1. Change config in excel.php

    'use_bom' => false,

  2. Use mb_convert_encoding to convert content to before export.

    $exportData = mb_convert_encoding($exportData, "SJIS", "UTF-8");
    $pblClassExport = new \App\Exports\PblClassExport($exportData, 'test.csv');

But it's not working. The encoding of csv file auto change by file content :( I hope get your help. Thank you so much!

https://stackoverflow.com/questions/65838394/how-can-i-set-encoding-for-export-csv-with-laravel-excel-in-laravel January 22, 2021 at 10:07AM

没有评论:

发表评论