I have a CSV file that I'm generating with Javascript. I'm setting the encoding to utf-8, appending the data and URI encoding the output before making it available for download, like so:
const csvContent =
data:text/csv;charset=utf-8,${csvData}
const encodedUri = encodeURI(csvContent)
When opening the file in an application that enforces UTF-8 encoding as standard (.e.g LibreOffice), the file opens fine with non-ASCII text, French and Arabic as an example. However, when attempting to open the file in Excel, which as I understand it, uses windows-1252 by default, the output understandably displays garbage text.
My question is; is there anyway to force Excel to open the file as UTF-8 without having the user manually change their encoding? I'm in a position where I can't expect users to do this.