[GH-ISSUE #42] "Content is Unreadable" error when strings contain control characters #34

Closed
opened 2026-05-05 11:27:20 -06:00 by gitea-mirror · 5 comments
Owner

Originally created by @sw1020 on GitHub (Dec 16, 2015).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/42

Issue with Content is Unreadable. Open and Repair

I am using libxlsxwriter to make a node addon.

I found : when I write the utf-8 string with some special characters , it will cause the problem
for exzample: <Buffer e5 9b be 14 e5 9b be>

pls help

Originally created by @sw1020 on GitHub (Dec 16, 2015). Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/42 Issue with Content is Unreadable. Open and Repair I am using libxlsxwriter to make a node addon. I found : when I write the utf-8 string with some special characters , it will cause the problem for exzample: <Buffer e5 9b be 14 e5 9b be> pls help
gitea-mirror 2026-05-05 11:27:20 -06:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@jmcnamara commented on GitHub (Dec 16, 2015):

The "Content is Unreadable. Open and Repair" error is Excel's standard warning for any validation error in the XML used for the components of the XLSX file. It doesn't really help to identify the problem.

You will need to submit a small working example that demonstrates the issue. See the Bug Reporting Guidelines.

Note, libxlsxwriter does work with UTF-8. There is an example in the docs/repo and there are several test cases that test it.

John

<!-- gh-comment-id:165056652 --> @jmcnamara commented on GitHub (Dec 16, 2015): The "Content is Unreadable. Open and Repair" error is Excel's standard warning for any validation error in the XML used for the components of the XLSX file. It doesn't really help to identify the problem. You will need to submit a small working example that demonstrates the issue. See the [Bug Reporting Guidelines](https://github.com/jmcnamara/libxlsxwriter/blob/master/CONTRIBUTING.md). Note, libxlsxwriter does work with UTF-8. There is an [example in the docs/repo](http://libxlsxwriter.github.io/utf8_8c-example.html) and there are several test cases that test it. John
Author
Owner

@sw1020 commented on GitHub (Dec 16, 2015):

sorry
the utf-8 string example (in hex): e5 9b be 14 e5 9b be
if i replace 0x14 to 0x20 ,it will work fine

<!-- gh-comment-id:165087971 --> @sw1020 commented on GitHub (Dec 16, 2015): sorry the utf-8 string example (in hex): e5 9b be 14 e5 9b be if i replace 0x14 to 0x20 ,it will work fine
Author
Owner

@jmcnamara commented on GitHub (Dec 16, 2015):

The non-unicode character 0x14 is a control character. These aren't currently supported in libxlsxwriter.

I'll fix that in a later version but for now make sure that your strings don't contain control characters.

<!-- gh-comment-id:165104792 --> @jmcnamara commented on GitHub (Dec 16, 2015): The non-unicode character 0x14 is a control character. These aren't currently supported in libxlsxwriter. I'll fix that in a later version but for now make sure that your strings don't contain control characters.
Author
Owner

@jmcnamara commented on GitHub (Dec 16, 2015):

Here is an example program that demonstrates the issue:

#include "xlsxwriter.h"

int main() {

    lxw_workbook  *workbook  = new_workbook("gh42_1.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

    char string[] = {0xe5, 0x9b, 0xbe, 0x14, 0xe5, 0x9b, 0xbe, 0x00};

    worksheet_write_string(worksheet, 0, 0, string, NULL);

    workbook_close(workbook);

    return 0;
}

And here is a working example with the control character replaced with a space:

#include "xlsxwriter.h"

int main() {

    lxw_workbook  *workbook  = new_workbook("gh42_2.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);

    char string[] = {0xe5, 0x9b, 0xbe, 0x20, 0xe5, 0x9b, 0xbe, 0x00};

    worksheet_write_string(worksheet, 0, 0, string, NULL);

    workbook_close(workbook);

    return 0;
}
<!-- gh-comment-id:165109703 --> @jmcnamara commented on GitHub (Dec 16, 2015): Here is an example program that demonstrates the issue: ``` c #include "xlsxwriter.h" int main() { lxw_workbook *workbook = new_workbook("gh42_1.xlsx"); lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL); char string[] = {0xe5, 0x9b, 0xbe, 0x14, 0xe5, 0x9b, 0xbe, 0x00}; worksheet_write_string(worksheet, 0, 0, string, NULL); workbook_close(workbook); return 0; } ``` And here is a working example with the control character replaced with a space: ``` c #include "xlsxwriter.h" int main() { lxw_workbook *workbook = new_workbook("gh42_2.xlsx"); lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL); char string[] = {0xe5, 0x9b, 0xbe, 0x20, 0xe5, 0x9b, 0xbe, 0x00}; worksheet_write_string(worksheet, 0, 0, string, NULL); workbook_close(workbook); return 0; } ```
Author
Owner

@jmcnamara commented on GitHub (Dec 21, 2015):

Fixed in version 0.2.7 and the master HEAD on Github.

Thanks.

<!-- gh-comment-id:166262021 --> @jmcnamara commented on GitHub (Dec 21, 2015): Fixed in version 0.2.7 and the master HEAD on Github. Thanks.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/libxlsxwriter#34
No description provided.