Datatables export csv has unicode symbols pound symbol, how to get rid of this?
Datatables export csv has unicode symbols pound symbol, how to get rid of this?
mohan5070
Posts: 12Questions: 2Answers: 1
When i try to export a csv file which has pound symbol in one particular column,, it will get appended with "£" this character..
Kindly guide me to get rid of this.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I want only pound symbol.. i tried export options to replace that extra character.. but it removed pound symbol as well..
This is my code for removing extra character
Please help me to fix this
Happy to take a look at a test case if you provide a link (per the forum rules).
Allan
Hi Allan,
Thanks for quick reply. I have added my code here. https://jsfiddle.net/mohan5070/e6hhfx4h/
Please have a look.. unfortuanately i am not able to show the csv button in jsfiddle.
Kindly have a look at my code and if possible try csv export you will get to know what is the issue..
With the buttons in, it appears to work just fine for me: https://jsfiddle.net/e6hhfx4h/1/ .
Allan
With your changes.. i am still seeing the same error... Screenshot attached..
I am using windows machine...
If you view the CSV file in a text Editor, what do you see?
Allan
When i open with text Editor "Notepad",, it coming like this:-
"name","Amount"
"abc","£159.5"
"xyz","£159.5"
Sounds like an Excel issue in that case . Opening it in LibreOffice and it works no problem.
Does Excel have an open in UTF-8 option?
Allan
I'd forgotten I have Excel in VM. Just tired it and right enough it mashes the UTF8 characters.
You are far from the only one to have this issue with Excel - this SO thread among many others discusses it.
So you need to jump through Excel hoops to have it read CSV as UTF-8. Or just export a Excel file from Buttons.
Allan
Sorry Allan.. I am still not clear what has to be done to resolve this extra characters
Two options that I can see:
excelHtml5
button insteadYou will not be able to double click the CSV file and have Excel read it correctly. That is an Excel issue. Not one with the CSV file.
Allan
Hi Allan..
I am using excel export. it opens up the file explorer to add filename for saving the excel file.. How can i get rid of this file explorer and directly download the excel file
Thanks,
mohan
If you are using the Flash button (
excelFlash
) there is no way to remove the save dialogue. That is part of the Flash run time and there is no option to avoid that.If you are using the HTML5 button (
excelHtml5
) then it is entirely dependent upon the browser settings. For example on Chrome Mac for me it will immediately download without a "save as" box.Allan
Thanks Allan
Hi Allan,,
I tried using excel button for export.. but the button is not showing firefox..
Could you tell me what could be the reason?
I dont want to use flash installing process.. Is there any other native way of fixing this?
Without a link to the page showing the issue I don't know what is causing that I'm afraid. As you'll be able to see in my examples, the Excel button should appear in Firefox.
Allan
I am not able reproduce the issue in Jsfiddle .. Same dependency files i am injecting in my backbone module.. but excel button not showing up in firefox.. if I install flash for firefox then it shows up...
I am wondering how come this works fine in jsfiddle? not sure whether this jsFiddle has inbuilt Flash or not?
these are the files i included in my module
require('https://cdn.datatables.net/1.10.11/js/jquery.dataTables.min.js');
require('https://cdn.datatables.net/buttons/1.2.4/js/dataTables.buttons.min.js');
require('https://cdn.datatables.net/buttons/1.1.2/css/buttons.dataTables.min.css!');
require('https://cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js');
require('https://cdn.rawgit.com/bpampuch/pdfmake/0.1.18/build/vfs_fonts.js');
require('https://cdn.datatables.net/buttons/1.2.4/js/buttons.html5.min.js');
require('https://cdn.datatables.net/buttons/1.2.4/js/buttons.flash.min.js');
then i tried
$('#example').DataTable( {
"bProcessing" : true,
dom: 'Bfrtip',
buttons: [
'excelHtml5'
],
} );
No. Its the browser that would have Flash built in order, not a site.
I don't see any issue with the above code, that looks like it should basically work. I'd really need a link to a page showing the issue to be able to offer any help. If it can't be reproduced on JSFiddle, then there must be something in your local page that is causing the problem. What it is - I have no idea .
Allan