0
                var encodedUri =  encodeURI( "data:text/csv;charset=utf-8," + response.data);
                
                var link = document.createElement("a");
                link.setAttribute("href", encodedUri);
                if(!this.filter.periodFromLastSearch && !this.filter.periodToLastSearch)
                {
                    link.setAttribute("download", `review.csv`);
                }
                else{
                    link.setAttribute("download", `review${this.filter.periodFromLastSearch.replace(/-/g,'')}-${this.filter.periodToLastSearch.replace(/-/g,'')}.csv`);
                }
                document.body.appendChild(link); 
                link.click();
                document.body.removeChild(link);

This is the way I create my csv file but when having characters like "åäö" I can't seem to get them into the actual file. I have tried using the respective codes \u00F6 in the string before encodeURI is done and after.

Anyone experienced this issue?

Yooric
  • 87
  • 8
  • Replacing `response.data` with the literal `"åäö"` works for me. – xehpuk Nov 17 '20 at 16:55
  • I've tried doing response.data = response.data.replace('BalanceChange','Nettof\u00F6r\u00E4ndring'); but doesn't solve it. Still Nettoförändring in the excel when I open it – Yooric Nov 17 '20 at 17:02
  • How do you open the file? – xehpuk Nov 17 '20 at 17:03
  • 3
    Does this answer your question? [Is it possible to force Excel recognize UTF-8 CSV files automatically?](https://stackoverflow.com/questions/6002256/is-it-possible-to-force-excel-recognize-utf-8-csv-files-automatically) – xehpuk Nov 17 '20 at 17:11

0 Answers0