I am displaying table on my UI with Russian words. I want to export this to CSV, it works for english words but does not work for Russian words. Help!
I tried multiple things but all does not work. I am sharing the code and screenshot below.
var tableToExcel = (function () {
var uri = 'data:application/vnd.ms-excel;base64,'
//, template = '{table}' //This was my previous code and i changes to below line
,template = '<html xmlns:o=\'urn:schemas-microsoft-com:office:office\' xmlns:x=\'urn:schemas-microsoft-com:office:excel\'xmlns=\'http://www.w3.org/TR/REC-html40\'><meta charset=\'UTF-8\'><head>{table}</html>'
,base64 = function (s) { return window.btoa(unescape(encodeURIComponent(s))) }
,format = function (s, c) { return s.replace(/{(\w+)}/g, function (m, p) { return c[p]; })}
return function (tableData, name, filename) {
var ctx = { worksheet: name || 'Worksheet', table: tableData }
document.getElementById("dlink").href = uri + base64(format(template, ctx));
document.getElementById("dlink").download = filename;
document.getElementById("dlink").click();
}
})();
Excel must show all the russian words as it is showing in case of English.enter image description here
Please see the the screenshot for reference.
Please see the the screenshot for reference.
Display excel with russian words but it excel foes not show russian words instead it show in different characters.enter image description here