exceljs / exceljs

Excel Workbook Manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't get hebrew to display correctly in a generted CSV file

adame21 opened this issue · comments

commented

Hello,

I've recently started using the lib and am loving the ease of use and options.

My only problem is that hebrew strings are not displaying correctly.

I have tried all kinds of encoding/decoding but nothing seems to work.

Does this lib support hebrew? if so, can you point me in the right direction to get it working?

What im doing right now is this:

                worksheet.addRow({
message:"משהו שכתוב בעברית" // this translates to: "something in hebrew" 
})

The CSV file gets generated perfectly, but what I get in the "message" field is something like this:
׳�׳©׳”׳• ׳©׳›׳×׳•׳‘ ׳‘׳¢׳‘׳¨׳™׳×

I hope this is enough information to resolve this.
Once again - loving this lib, thanks so much for making it.

Thanks :)

I think the problem is with the encoding. When you save it, try something like this:

const wb = new ExcelJS.Workbook();
const ws = wb.addWorksheet('wheee');
ws.getCell('A1').value = 'משהו שכתוב בעברית';
wb.csv.writeFile('test.csv', { encoding: 'UTF-8' })