Skip to content

Conversation

@fcrick
Copy link
Contributor

@fcrick fcrick commented Feb 13, 2017

_x000D_ style replacements always have exactly 4 hexadecimal characters.

If in Excel, you type _xd_ in a cell, js-xlsx will give this string special treatment, even though Excel doesn't consider it to be significant.If you enter _x000D_ in a cell in Excel, the leading underscore will be escaped by Excel as without that it would be treated as an escape.

@coveralls
Copy link

coveralls commented Feb 13, 2017

Coverage Status

Coverage remained the same at 95.161% when pulling 67c9f19 on fcrick:escape_four_only into ab2eceb on SheetJS:master.

@SheetJSDev
Copy link
Contributor

Good catch! This part is actually explained in ECMA-376 22.4.2.4 bstr:

Unicode characters that cannot be directly represented in XML as defined by the XML 1.0 specification, shall be escaped using the Unicode numerical character representation escape character format xHHHH, where H represents a hexadecimal character in the character's value. [Example: The Unicode character 8 is not permitted in an XML 1.0 document, so it shall be escaped as x0008. end example] To store the literal form of an escape sequence, the initial underscore shall itself be escaped (i.e. stored as x005F). [Example: The string literal x0008 would be stored as x005F_x0008. end example]

Can you do the following:

  • restart from the current master

  • make the change to bits/22_xmlutils.js and odsbits/22_xmlutils.js

  • run make and confirm that the same changes appear in xlsx.js and ods.js

  • just above that line, in the function body, add a comment /* 22.4.2.4 bstr (Basic String) */

We'll need to delve further into both the write and read sides to make sure everything is consistent, but for now that will suffice.

@fcrick fcrick force-pushed the escape_four_only branch from 67c9f19 to f113fb1 Compare March 6, 2017 02:44
@coveralls
Copy link

coveralls commented Mar 6, 2017

Coverage Status

Coverage remained the same at 94.598% when pulling f113fb1 on fcrick:escape_four_only into 3d1f0f7 on SheetJS:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage remained the same at 94.598% when pulling f113fb1 on fcrick:escape_four_only into 3d1f0f7 on SheetJS:master.

@coveralls
Copy link

coveralls commented Mar 6, 2017

Coverage Status

Coverage remained the same at 94.598% when pulling f113fb1 on fcrick:escape_four_only into 3d1f0f7 on SheetJS:master.

@fcrick
Copy link
Contributor Author

fcrick commented Mar 6, 2017

this what you had in mind?

@SheetJSDev
Copy link
Contributor

@fcrick looks good, check your email

@SheetJSDev SheetJSDev merged commit f113fb1 into SheetJS:master Mar 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants