DataTables Button CSV weird characters on first column title
DataTables Button CSV weird characters on first column title

Hi all, I'm having this issue when exporting to CSV using the buttons plugin, the first column has some weird characters before the Title. Please refer to the screenshot:
http://collabshot.com/show/5hlD8k
I'm currently using nightly build from (today).
Any help will be appreciated.
Thanks!
This discussion has been closed.
Answers
That's the UTF8 BOM. There isn't currently a way to disable that using a configuration option.
What spreadsheet viewer are you using? I'm surprised there are any around that can't handle the BOM.
Allan
HI thanks,
I'm on a OSX, I see that in Numbers and also in a plain text editor like TextEdit and Sublime.
Any pointers ?
Thanks
Odd! I don't see it at all in Sublime. I don't have numbers (I'll purchase that soon to test this).
What browser were you using to create the file?
Allan
I tried Chrome and FF and see the same issue. Not sure what to do next :(
I've just tried downloading a CSV file from this example and then opening it in Numbers 3.6.1 (2566). It appears to open without issue and no BOM in the first cell.
Allan
I figured out the solution to those looking for it, you have to not use the minified version and instead get the full from here: https://cdn.datatables.net/buttons/1.1.2/js/buttons.html5.js
and change the +charset on line 607 to +'UTF-8-BOM' instead so that the section from 606 to 609 looks like this:
That prevents those initial starting chars from appearing for CSV without breaking it for the other buttons if you try to change the charsets earlier in the code.
Interesting - thanks for posting this. I'll look into it further.
Allan
I had the same issue, thanks for the solution @MrLawliet
That fix isn't really correct.
My browser (firefox on CentOS 6.6) was trying to use charset = ';charset=UTF-8'
but when I changed it to use ';charset=UTF-8-BOM', that didn't help.
removing charset from the line did fix it.
_saveAs(
new Blob( [output], {type: 'text/csv'} ),
_filename( config )
);
I guess your fix 'works' because it doesn't actually say ';charset=xxx', and the type of 'text/csvUTF-8-BOM' doesn't confuse the browser...
It was working prior to 1.1.2 (I don't remember what version I had before).
I'm using the bootstrap themes too, but that probably doesn't matter.