mirror of
https://github.com/jmcnamara/libxlsxwriter.git
synced 2026-05-15 14:15:54 -06:00
[GH-ISSUE #276] Issue with writing special characters to xlsx file. #220
Labels
No labels
awaiting user feedback
bug
cmake
cmake
docs
feature request
in progress
long term
medium term
medium term
pull-request
question
question
ready to close
short term
under investigation
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/libxlsxwriter#220
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @StephenRademaker on GitHub (Mar 13, 2020).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/276
Originally assigned to: @jmcnamara on GitHub.
Issue with writing special characters to xlsx file.
I am using libxlsxwriter version 0.9.4.
I have build the library according to CMake and also via vcpkg as described in the document (x86 and x64 release). However in all cases I get the same error.
I am using Visual Studio 2019 version 16.4.6
Platform Toolset: Visual Studio 2019 v142
With the compiler Visual C++
Here is some code that demonstrates the problem:
#include "xlsxwriter.h"
int main() {
}
The problem occurs when you open the xlsx file in Microsoft Excel.
Then comes the following message:
Removed Part: /xl/sharedStrings.xml part with XML error. (Strings) Illegal xml character. Line 2, column 128.
Removed Records: Cell information from /xl/worksheets/sheet1.xml part
It seems that special characters like "é" and "ë" are not written correctly, despite of the worksheet_write_string function not giving an error.
Is this a bug or am I doing something wrong?
Awaiting your reply, thank you in advance, greetings, Stephen.
@jmcnamara commented on GitHub (Mar 21, 2020):
Excel, and libxlsxwriter, only support UTF-8 for non ASCII characters. See the docs on worksheet_write_string() and this utf8.c example.
It will work in Visual Studio if you use a UTF-8 encoded file. You may, or may not, also need to tell VS that your file is UTF-8 encoded.