[GH-ISSUE #460] Bug if worksheet names has specials chars like "é" (French letters) #358

Closed
opened 2026-05-05 12:11:53 -06:00 by gitea-mirror · 3 comments
Owner

Originally created by @PyrosBrother on GitHub (Oct 25, 2024).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/460

Originally assigned to: @jmcnamara on GitHub.

Issue with french characters in worksheet name. All is writen on disk but Excel doesn't want ton open the created file (Error : "Content is Unreadable. Open and Repair").

I am using MSVC 2022, OS = Windows 11 Pro (and Excel 2021 to open the created file) and libxlsxwriter 1.1.8.

Here is some code that demonstrates the problem:

#include "xlsxwriter.h"

int main() {

    lxw_workbook  *workbook  = workbook_new("bug_report.xlsx");
    lxw_worksheet *worksheet = workbook_add_worksheet(workbook, "Stéphane");

    worksheet_write_string(worksheet, 0, 0, "Hello", NULL);
    worksheet_write_number(worksheet, 1, 0, 123, NULL);

    return workbook_close(workbook);
}
Originally created by @PyrosBrother on GitHub (Oct 25, 2024). Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/460 Originally assigned to: @jmcnamara on GitHub. Issue with french characters in worksheet name. All is writen on disk but Excel doesn't want ton open the created file (Error : "Content is Unreadable. Open and Repair"). I am using MSVC 2022, OS = Windows 11 Pro (and Excel 2021 to open the created file) and libxlsxwriter 1.1.8. Here is some code that demonstrates the problem: ```C #include "xlsxwriter.h" int main() { lxw_workbook *workbook = workbook_new("bug_report.xlsx"); lxw_worksheet *worksheet = workbook_add_worksheet(workbook, "Stéphane"); worksheet_write_string(worksheet, 0, 0, "Hello", NULL); worksheet_write_number(worksheet, 1, 0, 123, NULL); return workbook_close(workbook); } ```
gitea-mirror 2026-05-05 12:11:53 -06:00
Author
Owner

@jmcnamara commented on GitHub (Oct 25, 2024):

It should work as expected if the file is UTF-8 encoded. That is the only encoding supported by Excel. Here is the output from your sample code, unedited, compiled with clang on macOS:

screenshot

<!-- gh-comment-id:2437565901 --> @jmcnamara commented on GitHub (Oct 25, 2024): It should work as expected if the file is UTF-8 encoded. That is the only encoding supported by Excel. Here is the output from your sample code, unedited, compiled with clang on macOS: ![screenshot](https://github.com/user-attachments/assets/b6650a4d-3ec9-4fc2-aa0c-fbd3304970a4)
Author
Owner

@PyrosBrother commented on GitHub (Oct 28, 2024):

Hello,
Thank you for your answer.
You're right with UTF8 string conversion all is correct.
Sorry to miss that and for the noise.
Maybe a FAQ to remember that all the strings should be UTF8 encoded will be a idea ?
Your lib is wonderful and helps a lot.
Regards.

<!-- gh-comment-id:2440927927 --> @PyrosBrother commented on GitHub (Oct 28, 2024): Hello, Thank you for your answer. You're right with UTF8 string conversion all is correct. Sorry to miss that and for the noise. Maybe a FAQ to remember that all the strings should be UTF8 encoded will be a idea ? Your lib is wonderful and helps a lot. Regards.
Author
Owner

@jmcnamara commented on GitHub (Oct 28, 2024):

@PyrosBrother Thanks for the feedback. I'm glad you sorted it out.

<!-- gh-comment-id:2442296737 --> @jmcnamara commented on GitHub (Oct 28, 2024): @PyrosBrother Thanks for the feedback. I'm glad you sorted it out.
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#358
No description provided.