Skip to content

[fix]: Replace invalid-XML control chars from data values on save#192

Merged
MiquelAdell merged 3 commits into
developmentfrom
fix/sanitize-control-chars-on-save
May 21, 2026
Merged

[fix]: Replace invalid-XML control chars from data values on save#192
MiquelAdell merged 3 commits into
developmentfrom
fix/sanitize-control-chars-on-save

Conversation

@deeonwuli
Copy link
Copy Markdown
Contributor

📌 References

📝 Implementation

The client report surfaced a Bulk Load Excel export that failed to open in MS Excel (error237400_01.xml: "Illegal xml character. Line 395, column 174" in /xl/sharedStrings.xml).
Root cause: an invisible vertical tab (\x0B) had been entered into a TEXT data value. XLSX is XML 1.0; XML 1.0 forbids most C0 control characters, so Excel rejected the file. LibreOffice silently strips these on save, which is why a LibreOffice round-trip "fixed" the file.

This PR sanitizes data values at the save boundary in autogen-forms so the same characters never get persisted again:

Out of scope (sibling task in Bulk Load): historical bad values already in DHIS2 and values entered through other paths (DHIS2 web data entry, imports) still need a defensive strip on the Bulk Load xlsx export side. Bulk Load PR 399

#869dbc90g

@deeonwuli deeonwuli requested review from MiquelAdell and eperedo May 20, 2026 16:13
@deeonwuli deeonwuli changed the title [fix]: Strip invalid-XML control chars from data values on save [fix]: Replace invalid-XML control chars from data values on save May 20, 2026
@bundlemon
Copy link
Copy Markdown

bundlemon Bot commented May 20, 2026

BundleMon

No change in files bundle size

Groups updated (1)
Status Path Size Limits
Build Folder
./**/*
1.55MB (+60B 0%) +20%

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

Copy link
Copy Markdown
Contributor

@eperedo eperedo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks @deeonwuli

Copy link
Copy Markdown
Contributor

@MiquelAdell MiquelAdell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested by inputing the result of this command printf 'TEST1\vTEST2' | pbcopy it works

@MiquelAdell MiquelAdell merged commit f0a6727 into development May 21, 2026
6 checks passed
@MiquelAdell MiquelAdell deleted the fix/sanitize-control-chars-on-save branch May 21, 2026 09:03
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