In my application I have a list of items which can be exported to CSV.
For this, I create a Blob as follows:
var BOM = "\ufeff";
var blob = new Blob([csv], {
type: 'csv;charset=utf-8'
});
In case that the data in this list contains special characters, the exported file was not opened correctly in MS Excel. So I added a line to my code (the second line in the following snippet), as I found in many Q&A forums:
var BOM = "\ufeff";
var csv = BOM + csv;
var blob = new Blob([csv], {
type: 'csv;charset=utf-8'
});
That works - the CSV is opened correctly in Excel, but then, when saving the file - it is save in text format and not as CSV. Which meant I need to "Save As" the file and change the default type if I want it to be saved correctly.
Is it really like this? Do I really have to choose between the two options - see the file or save it correctly?