vendredi 18 août 2017

Error unicode export csv file - Laravel/Excel

I have a problem, can you guys help me ?

I use Maatwebsite/Laravel-excel to export japanese text from database to csv file.

When I open export file using MS Excel, I got a lot of symbols.

enter image description here

But when I open it using Notepad++ or upload to Google Drive, I got exactly I want.

enter image description here

How can I fix it ?

This is my code :

    public function export($type, $properties, $data)
{
    if (in_array($type, self::EXPORT_TYPE)) {
        try {
            $export = Excel::create($properties['_title'], function ($excel) use ($data, $properties) {
                $excel->sheet('Sheet', function ($sheet) use ($data) {
                    foreach ($data as $item) {
                        $sheet->fromArray($item);
                    }
                });
            })->export('csv');
        } catch (Exception $error) {
            throw $error;
        }
    }
}



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2wlGSnP
via IFTTT

Aucun commentaire:

Enregistrer un commentaire