I have a web application that generates a UTF-8 .csv and returns it to the user with the following code.
const createCSV = () => {
...
return new Blob(["\ufeff" + csvContent], {
type: "text/csv;charset=utf-8",
})
}
I had to add the \ufeff
BOM in order to get the ≤
character to render correctly in Excel
I am using Filesaver.js to trigger the save to the user's computer
onClick={() => saveAs(createCSV(attributes), "template.csv", {autoBom: true})}
This seems to work fine for Mac users, but when a user on Windows clicks the download button, the download prompt is showing the file type as Unicode Text
.
Any ideas why the file is showing up as Unicode Text
instead of .csv
for Windows users?