I am using PhpSpreadsheet to read files (csv, xls, xlsx). But when I reading csv files, the content of Chinese word can't read (it's null). enter image description here
This csv file: enter image description here
This is my code:
<?php
require 'vendor/autoload.php';
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
use PhpOffice\PhpSpreadsheet\Reader\Xls;
use PhpOffice\PhpSpreadsheet\Reader\Csv;
$inputFileName = 'input1.csv';
//load files
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($inputFileName);
//change the file to array
$sheetData = $spreadsheet->getActiveSheet()->toArray(null,true,true,true);
print_r($sheetData);
?>
I had try setlocale(LC_ALL, 'zh_TW.UTF-8 UTF-8');
but it didn't work.