Closed w-mazed closed 5 years ago
I tried even:
$_bom=true; // and passed the variable to the view
It still doesn't work.
this works for me this creates with utf-8 character set
public function export()
{
$data = [
['a', 'b', 'c'],
[1, 2, 3],
['سلام', 'العربية', 'me'],
];
$_serialize = 'data';
$this->viewBuilder()->setClassName('CsvView.Csv');
$this->set(compact('data', '_serialize'));
}
I tried a lot of tricks to solve this issue but I fall,
You don't need any tricks. Just make sure the file encoding for your PHP files and your database tables / columns (and encoding in connection config) is set to UTF-8.
@ADmad thank you for your answer but indeed, datase, tables and columns all are encoded in UTF-8.
I used https://github.com/thephpleague/csv and it works fine after Setting the outputted BOM sequence (BTW I tried with $_bom=true; and it didn't work). So may be the problem is there.
Only you can debug and figure out what the problem is. If you stumble upon a bug you can provide details to reproduce or a fix for it.
I tried a lot of tricks to solve this issue but I fall, I tried this config:
$_extension = 'mbstring'; $_dataEncoding = 'UTF-8'; $_csvEncoding = 'UTF-16LE';
But it solve accentued chars but not arabic chars, any solution for that ?