material-table icon indicating copy to clipboard operation
material-table copied to clipboard

CSV export breaks with "#" in data

Open rbeers opened this issue 7 years ago • 4 comments

Any data that contains "#" breaks the csv export. Using chrome browser. I assume # is being used as a break in the data structure. Is there any way to specify another break character or handle the case for # symbol?

rbeers avatar Mar 06 '19 15:03 rbeers

Hi @rbeers ,

This bug is about https://github.com/mbrn/filefy . It is my project too. I will look at it asap.

mbrn avatar Mar 06 '19 16:03 mbrn

Hi @rbeers ,

Which version do you use?

If you use latest version of material-table. We already fixed this problem. but you should remove node_modules and package-lock.json(or yarn). Then npm install every dependency again.

Because we fixed this problem with [email protected] and upgrade material-table to it. Your project may use [email protected] still. Please check it.

mbrn avatar Mar 09 '19 09:03 mbrn

I upgraded to the latest version of material-table, removed node_modules and all lock files, re-installed, and verified [email protected] in dependency tree. The problem still persists for me. Here is the example I'm using

 <MaterialTable
    columns={[
      { title: 'Adı', field: 'name' },
      { title: 'Soyadı', field: 'surname' },
      { title: 'Doğum Yılı', field: 'birthYear', type: 'numeric' },
      {
        title: 'Doğum Yeri',
        field: 'birthCity',
        lookup: { 34: 'İstanbul', 63: 'Şanlıurfa' },
      },
    ]}
    data={[
      { name: 'Mehmet', surname: 'Baran', birthYear: 1987, birthCity: 63 },
      { name: 'Rob', surname: 'Beers #', birthYear: 1987, birthCity: 63 },
      { name: 'Test', surname: 'User', birthYear: 1987, birthCity: 63 },
    ]}
    title="Demo Title"
    options={{
      exportButton: true,
    }}
  />

CSV exported:

<U+FEFF>"Adı","Soyadı","Doğum Yılı","Doğum Yeri"
"Mehmet","Baran",1987,63
"Rob","Beers

Chrome Version 72.0.3626.121 (Official Build) (64-bit)

rbeers avatar Mar 11 '19 09:03 rbeers

For solution: see https://github.com/mbrn/filefy/issues/10

rbeers avatar Mar 11 '19 11:03 rbeers