nkuprins opened a new pull request, #991: URL: https://github.com/apache/fesod/pull/991
Related: #696 ## Purpose of the pull request Characters that XML 1.0 forbids are stored in a cell as `_xHHHH_` escapes. Fesod undid them only for cells backed by `sharedStrings.xml`, so `t="inlineStr"` and `t="str"` reached the caller with the raw escape. A value written by Fesod did not survive being read back by Fesod. The clearest case is a value escaped with `EscapeHexCellWriteHandler`, which stores the literal `_xB9f0_` as `_x005F_xB9f0_` precisely so a decoding reader restores it: | reading a cell written as `Product_x005F_xB9f0_Code` | result | | --- | --- | | POI | `Product_xB9f0_Code` | | Fesod, before / after | `Product_x005F_xB9f0_Code` / `Product_xB9f0_Code` | Why this is a defect and not intended behaviour: - Decoding is already an asserted contract for the other storage form - `CompatibilityTest#readXlsxWithEscapeSequence` pins it for `sharedStrings.xml`. - POI decodes inline strings on both of its read paths - the DOM `XSSFCell` and the streaming `XSSFSheetXMLHandler`, each via `XSSFRichTextString#getString()`. - No test asserts that a raw escape survives a read. ## What's changed? - **`XlsxEscapeUtils` (new)** - `utfDecode` moved here from `SharedStringsTableHandler` unchanged, and both read paths now call it. The smaller change would have been to make the existing method `public` and call it from `CellTagHandler`, but that leaves a cell parser depending on the `sharedStrings.xml` parser for decoding that has nothing to do with shared strings, and the next caller inherits the same detour. The escape convention belongs to neither handler, so it moved to `util/`. Happy to switch to the two-line version if you prefer the smaller diff. - **`CellTagHandler`** - the `DIRECT_STRING` branch now decodes instead of falling through to the `ERROR` branch; it sets the same `STRING` type as before. - **`InlineStringUtfDecodeTest` (new)** - two round-trips, one plain `_x0002_` escape and one literal `_x…_` via `EscapeHexCellWriteHandler`. Both verified to fail against the unfixed code. ## Checklist - [x] I have read the [Contributor Guide](https://fesod.apache.org/community/contribution/). - [x] I have written the necessary doc or comment. - [x] I have added the necessary unit tests and all cases have passed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
