Text encoding issues in Props.LastAuthor property #822

Closed
opened 2017-09-28 07:43:18 +00:00 by fureweb-com · 4 comments
fureweb-com commented 2017-09-28 07:43:18 +00:00 (Migrated from github.com)

const bstr: string = e.target.result;
const wb = XLSX.read (bstr, {type: 'binary'});

There is a problem that the LastAuthor of the Props property of the workbook data read by the above command does not parse properly.

I checked the source a bit and found that in this case, data.asBinary () is used in xlsx's getdatastr function, so it can not be decoded in UTF-8. If you take data.asText () from here, it seems that you can get the XML document that is normally UTF-8 decoded successfully.

I think we need to fix this issue.

const bstr: string = e.target.result; const wb = XLSX.read (bstr, {type: 'binary'}); There is a problem that the LastAuthor of the Props property of the workbook data read by the above command does not parse properly. I checked the source a bit and found that in this case, data.asBinary () is used in xlsx's getdatastr function, so it can not be decoded in UTF-8. If you take data.asText () from here, it seems that you can get the XML document that is normally UTF-8 decoded successfully. I think we need to fix this issue.
SheetJSDev commented 2017-09-28 08:01:11 +00:00 (Migrated from github.com)

Good catch! The change should be

-		propdata = getzipstr(zip, strip_front_slash(dir.coreprops[0]), true);
+		propdata = utf8read(getzipdata(zip, strip_front_slash(dir.coreprops[0]), true));

We'll roll that out tomorrow with a test

Good catch! The change should be ```diff - propdata = getzipstr(zip, strip_front_slash(dir.coreprops[0]), true); + propdata = utf8read(getzipdata(zip, strip_front_slash(dir.coreprops[0]), true)); ``` We'll roll that out tomorrow with a test
fureweb-com commented 2017-09-28 08:07:14 +00:00 (Migrated from github.com)

thanks! :)

thanks! :)
SheetJSDev commented 2017-09-30 15:19:18 +00:00 (Migrated from github.com)

We added the changes in 0.11.5 along with some fun test files with author -- please update and check if that works

We added the changes in 0.11.5 along with some [fun test files with author `☃`](https://github.com/SheetJS/test_files/blob/master/author_snowman.xlsx?raw=true) -- please update and check if that works
fureweb-com commented 2017-10-01 00:38:45 +00:00 (Migrated from github.com)

Thank you! Now I can see a cute snowman :)

Image of snowman

Thank you! Now I can see a cute snowman :) ![Image of snowman](http://fureweb.com/issue-822-after.png)
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
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: sheetjs/sheetjs#822
No description provided.