Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Issue with sheet names containing multi-byte (UTF-8) characters #84
Sheet names longer than 32 bytes are disallowed by libxlsxwriter; however I believe the correct behavior is to disallow sheet names longer than 32 characters.
I am trying to debug a customer issue, and I believe the problem is that sanitized strings which are longer than 32 bytes but shorter than 32 characters are passing my program's internal checks, but then failing to be written out to the spreadsheet.
I'd suggest one of:
This is a bug that I had in the back of my mind and was on my TODO list to fix.
You are correct that the check should be on characters rather than bytes (like in the Perl and Python versions) and it was my intention to add a UTF-8 strlen. That same applies for most other length checks on user supplied data.
The worksheet name check also needs to disallow certain characters in the name:
And finally there should be suitable warning around this check as well.
Thanks @jmcnamara. Haven't tested but the patch looks fine to me; I'm looking forward to seeing it integrated.
I'll add NULL handling on my end so that is no problem. It might be useful to have a way to validate worksheet names without actually adding them, so that the error condition can be isolated in client code.