Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Revisions

1 of 2
Can Bozdemir
  • 453
  • 1
  • 5
  • 8

Javascript export CSV encoding utf-8 issue

I need to export javascript array to CSV file and download it. I did it but 'ı,ü,ü,ğ,ş' this charachters looks like 'ı Ã1⁄4 Ã1⁄4 ÄŸ ÅŸ' in the CSV file. I have tried many solutions recommended on this site but didn't work for me.

I added my code snippet, Can anyone solve this problem?

var csvString = 'ı,ü,ü,ğ,ş';
var a = window.document.createElement('a');
a.setAttribute('href', 'data:text/csv; charset=utf-8,' + encodeURIComponent(csvString));
a.setAttribute('download', 'example.csv');
a.click();

Can Bozdemir
  • 453
  • 1
  • 5
  • 8
lang-js

AltStyle によって変換されたページ (->オリジナル) /