brechtsanders / xlsxio

XLSX I/O - C library for reading and writing .xlsx files
MIT License
397 stars 113 forks source link

xlsxioread_sheetlist_next returns wrong cyrillic name #119

Open dezmen3 opened 1 year ago

dezmen3 commented 1 year ago

When trying to read all spreadsheet names from xlsx file, i'm getting correct english names, but cyrillic symbols turns into giberrish ones instead cyrillic letters. ` const char* input_file = argv[1]; xlsxioreader xlsxioread; if ((xlsxioread = xlsxioread_open(input_file)) == NULL) { fprintf(stderr, "Error opening XLSX file: %s\n", input_file); return 1; }

xlsxioreadersheetlist sheetlist;
const XLSXIOCHAR* sheetname = NULL;

if ((sheetlist = xlsxioread_sheetlist_open(xlsxioread)) != NULL) {
    while ((sheetname = xlsxioread_sheetlist_next(sheetlist)) != NULL) {
        //work with name
    }
}

`

Default cyrillic name in excel is "Лист1", xlsxioread_sheetlist_next gives it as "Лист1". Same thing with priting it to txt using fputs, in notepad++ it shows fine, but when you view it in Hex, it does same faulty symbols

brechtsanders commented 1 year ago

The resulting name should be UTF-8. Which encoding did you use to display the name?