Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for UTF-8 when downloading CSV #722

Closed
wants to merge 6 commits into from

Conversation

rinorbytyci
Copy link

This pull should add UTF-8 support for special / accented characters when downloading CSV files.

@coveralls
Copy link

coveralls commented Jun 26, 2019

Coverage Status

Coverage remained the same at 76.339% when pulling c8b55ab on rinorbytyci:master into a929a3f on gregnb:master.

@patorjk
Copy link
Collaborator

patorjk commented Aug 29, 2019

This can also be done with the onDownload method:

onDownload: (buildHead, buildBody, columns, data) => {
    return "\uFEFF" + buildHead(columns) + buildBody(data); 
} 

The problem with always adding the BOM in is that it's Excel specific, and the actual character will show up in some spreadsheet programs (ex: react-csv/react-csv#89).

@gabrielliwerant
Copy link
Collaborator

This library has intentionally steered away from providing specific types of exports as this can become a source of bloat. Specific implementations are left up to the devs and external libraries.

Perhaps a better use of this PR would be to add something to the documentation or to an example that points out how to work with downloads intended for Excel (or other programs).

@patorjk
Copy link
Collaborator

patorjk commented Jun 1, 2020

Excel specific, so closing for now. I'll add an example in the documentation though.

@patorjk patorjk closed this Jun 1, 2020
@jose1208
Copy link

// option
downloadOptions: {
filename: 'excel-format.csv',
separator: ';',
filterOptions: {
useDisplayedColumnsOnly: true,
useDisplayedRowsOnly: true,
}
},
//function
onDownload: (buildHead, buildBody, columns, data) => {
component.pdfReportAutoTable(
columns,
data
);
return false;
},

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

Successfully merging this pull request may close these issues.

5 participants