-
Notifications
You must be signed in to change notification settings - Fork 215
Fix for #238 - bug in new emoji support allowed some illegal characters. #239
Conversation
source/lib/cell/index.js
Outdated
@@ -6,6 +6,48 @@ const Style = require('../style/style.js'); | |||
const utils = require('../utils.js'); | |||
const util = require('util'); | |||
|
|||
const ampEncoded = { | |||
'"': '"', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why replace these characters with their HTML equivalents? When opening docs with Excel or LibreOffice, these are shown as their HTML literals and not their expected value.
e.g. I would expect that when I pass Cats & Dogs
into the cell string function, "Cats & Dogs" is displayed when opening the document with Excel, however, "Cats & Dogs" is the actual result. I imagine Goole Sheets would display the correct value, but not Excel or Libre Office.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was mostly following the ECMA-376
, but it may be unnecessary with xmlbuilder. I will update the sample and do some actual comparison.
Thanks for looking into this @mschnee! |
I've added a |
The list of XML valid characters is well known:
That regex would look like
I have updated |
I've renamed the PR. This wasn't about adding tests: it was about fixing a bug I introduced in a previous PR @natergj |
This looks great! Thanks, @mschnee! Sorry for the delay in getting it merged. I'll have a new version published to npm by the end of the weekend and this ill be part of that. |
This fix is for #238
A previous PR #75 updated
excel4node
to support XML 1.1-valid characters. Unfortunately, the XLSX / Office Open XML SpreadsheetML File Format is not a XML 1.1 format, only XML 1.0. This caused resultant files to be unreadable when certain categories of multipoint unicode characters (like skin-tone emoji) were rendered into it incorrectly.'<>"&
with the respective &escaped; versions.😂
for 😂,🤞🏼
for 🤞🏼 and so on.Please comment on other ways I may be able to increase coverage, quality, or test sampling :) .
(PS sorry for breaking XLSX files)