Closed DarkCobalt closed 7 years ago
This is file when i got error wycena_polis_2016-11-16 11-27.xls.zip
this is my promble too: iconv(): Detected an illegal character in input string ConvertEncoding('商品分类demo', 'UTF-8', 'CP1252')
To avoid this error,the first row must use utf-8 code in my excel file
seems like autodetect is not the same name as its in iconv. (MACCENTRALEUROPE vs MAC-CENTRALEUROPE)
what helped me is this:
// composer.json
"autoload": {
...
"files": ["override/StringHelper.php"]
},
copy builtin StringHelper to your override/StringHelper.php
location, and add the following "hack":
public static function convertEncoding($value, $to, $from)
{
if($from === "MACCENTRALEUROPE"){$from = "MAC-CENTRALEUROPE";} //patched
if($from === "MACCYRILLIC"){$from = "MAC-CYRILLIC";} //patched
if (self::getIsIconvEnabled()) {
$result = iconv($from, $to . self::$iconvOptions, $value);
if (false !== $result) {
return $result;
}
}
return mb_convert_encoding($value, $to, $from);
}
(edit: i can see that there were a fix for this, so if you can, use that :) )
Hi I have problem when try use function \Excel::load then i have error iconv
Code
$filePath = 'storage/uploads/valued/'.$this->filename; \Excel::load($filePath, function($excel){});
Package version, Laravel version
"laravel/framework": "5.1.*", "maatwebsite/excel": "~2.0.0"
Expected behaviour
ErrorException in String.php line 496: iconv(): Wrong charset, conversion from
MACCENTRALEUROPE' to
UTF-8' is not allowedin String.php line 496 at HandleExceptions->handleError('8', 'iconv(): Wrong charset, conversion from
MACCENTRALEUROPE' to
UTF-8' is not allowed', '/home/forge/default/vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/String.php', '496', array('value' => 'U�ytkownik Microsoft Office', 'to' => 'UTF-8', 'from' => 'MACCENTRALEUROPE')) at iconv('MACCENTRALEUROPE', 'UTF-8', 'U�ytkownik Microsoft Office') in String.php line 496 at PHPExcel_Shared_String::ConvertEncoding('U�ytkownik Microsoft Office', 'UTF-8', 'MACCENTRALEUROPE') in Excel5.php line 1244 at PHPExcel_Reader_Excel5->_readSummaryInformation() in Excel5.php line 623 at PHPExcel_Reader_Excel5->load('/home/forge/default/storage/uploads/valued/1479295210d287327d434a952d12b857fee0111cee.xls') in LaravelExcelReader.php line 227 at LaravelExcelReader->load('storage/uploads/valued/1479295210d287327d434a952d12b857fee0111cee.xls', null, false) in Excel.php line 118 at Excel->load('storage/uploads/valued/1479295210d287327d434a952d12b857fee0111cee.xls', object(Closure)) in Facade.php line 219 at Facade::__callStatic('load', array('storage/uploads/valued/1479295210d287327d434a952d12b857fee0111cee.xls', object(Closure))) in ImportValuedSheet.php line 57 at Excel::load('storage/uploads/valued/1479295210d287327d434a952d12b857fee0111cee.xls', object(Closure)) in ImportValuedSheet.php line 57 at ImportValuedSheet->handle() in ResumeManageController.php line 63 at ResumeManageController->postLoadFileValued(object(Request)) at call_user_func_array(array(object(ResumeManageController), 'postLoadFileValued'), array(object(Request))) in Controller.php line 256 at Controller->callAction('postLoadFileValued', array(object(Request))) in ControllerDispatcher.php line 164 at ControllerDispatcher->call(object(ResumeManageController), object(Route), 'postLoadFileValued') in ControllerDispatcher.php line 112 at ControllerDispatcher->Illuminate\Routing{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103 at Pipeline->then(object(Closure)) in ControllerDispatcher.php line 114 at ControllerDispatcher->callWithinStack(object(ResumeManageController), object(Route), object(Request), 'postLoadFileValued') in ControllerDispatcher.php line 69 at ControllerDispatcher->dispatch(object(Route), object(Request), 'App\Http\Controllers\Resumes\ResumeManageController', 'postLoadFileValued') in Route.php line 203 at Route->runWithCustomDispatcher(object(Request)) in Route.php line 134 at Route->run(object(Request)) in Router.php line 708 at Router->Illuminate\Routing{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Authenticate.php line 45 at Authenticate->handle(object(Request), object(Closure)) at call_user_func_array(array(object(Authenticate), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103 at Pipeline->then(object(Closure)) in Router.php line 710 at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 675 at Router->dispatchToRoute(object(Request)) in Router.php line 635 at Router->dispatch(object(Request)) in Kernel.php line 236 at Kernel->Illuminate\Foundation\Http{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 139 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Debugbar.php line 49 at Debugbar->handle(object(Request), object(Closure)) at call_user_func_array(array(object(Debugbar), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in VerifyCsrfToken.php line 50 at VerifyCsrfToken->handle(object(Request), object(Closure)) at call_user_func_array(array(object(VerifyCsrfToken), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in ShareErrorsFromSession.php line 49 at ShareErrorsFromSession->handle(object(Request), object(Closure)) at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in StartSession.php line 62 at StartSession->handle(object(Request), object(Closure)) at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37 at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in EncryptCookies.php line 59 at EncryptCookies->handle(object(Request), object(Closure)) at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in CheckForMaintenanceMode.php line 44 at CheckForMaintenanceMode->handle(object(Request), object(Closure)) at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103 at Pipeline->then(object(Closure)) in Kernel.php line 122 at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 87 at Kernel->handle(object(Request)) in index.php line 53