Import utf-8 headings Maatwebsite Laravel

怎甘沉沦 提交于 2019-12-24 17:08:26

问题


I'm using Maatwebsite in Laravel and it's very good option for excel works but I have one problem .. I have excel sheet with arabic heading, so when I import it , it converted to understand-less english character to fit array key .. So What is the solution for my problem?


回答1:


I know it's too late, but for someone else that may have the same problem, you should change the value of "heading" key to "original" in "import" array of config/excel.php file..

'import' => [
    ...
    'heading' => 'original',
],



回答2:


http://www.maatwebsite.nl/laravel-excel/docs/import

Look up the header about import encoding.

From thoose pages:

// When utilising a closure, you can pass the input encoding as third parameter.
Excel::load('filename.csv', function($reader) {

}, 'UTF-8');

// or without a closure, you can use it as second parameter.
Excel::load('filename.csv', 'UTF-8');

Does that solve the issue?




回答3:


I'm too late but this workerd for me, instead of a modifying import.php, in your controller add this

config(['excel.import.heading' => 'original' ]);


来源:https://stackoverflow.com/questions/34397671/import-utf-8-headings-maatwebsite-laravel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!