Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Add option to change the encoding of the whole exported csv file (not only the content) #871

Open
Defcon0 opened this issue Feb 23, 2022 · 1 comment

Comments

@Defcon0
Copy link

Defcon0 commented Feb 23, 2022

Hello,

I'm kind of having the same issue as described here:

#619

When I open a excel exported csv for example in EditPad Lite, the encoding is windows 1252. When I open a csv exported with this php bundle, it's utf8 even though I I did the following:

        $writer->openToBrowser('subscriptions.csv');

        $writer->setShouldAddBOM(false);

$data = array_map(function($value) {
                return iconv( 'UTF-8', 'Windows-1252', $value);
            }, $data);

            $writer->addRow(WriterEntityFactory::createRowFromArray($data));
        $writer->close();

Do you have any idea what I could do? Any help is highly appreciated :-)

Bye Defcon0

@adrilo
Copy link
Collaborator

adrilo commented Mar 3, 2022

Hi,
If the encoding is already Windows-1252, you don't need the iconv call. Unless you're trying to output a UTF-8 CSV.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants