Skip to content

escape should work with AbstractString.#60

Merged
ViralBShah merged 1 commit into
JuliaData:mainfrom
MarkNahabedian:naha_escape_AbstractString
Jun 19, 2026
Merged

escape should work with AbstractString.#60
ViralBShah merged 1 commit into
JuliaData:mainfrom
MarkNahabedian:naha_escape_AbstractString

Conversation

@MarkNahabedian

Copy link
Copy Markdown
Contributor

XML.escape did not support SubString because it was specialized on String intead of AbstractString.

MarkNahabedian added a commit to MarkNahabedian/AnotherParser.jl that referenced this pull request May 14, 2026
@joshday

joshday commented May 15, 2026

Copy link
Copy Markdown
Collaborator

Addressed in #54

@ViralBShah ViralBShah merged commit 241c9ec into JuliaData:main Jun 19, 2026
16 checks passed
mathieu17g added a commit that referenced this pull request Jun 20, 2026
CHANGELOG.md (new): itemises 0.3.9 — #56 (CDATA delimiter fix), #59 (next!/prev!),
#60 (escape AbstractString), #64 (OrderedCollections v2 compat); notes the move to
JuliaData. Changelog starts at 0.3.9 (earlier history via releases/tags).

test/runtests.jl: regression tests for the two fixes that merged without their own
coverage — prev() across a CDATA section (#56) and escape(::SubString) (#60).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
mathieu17g added a commit that referenced this pull request Jun 20, 2026
CHANGELOG.md (new): itemises 0.3.9 — #56 (CDATA delimiter fix), #59 (next!/prev!),
#60 (escape AbstractString), #64 (OrderedCollections v2 compat); notes the move to
JuliaData. Changelog starts at 0.3.9 (earlier history via releases/tags).

test/runtests.jl: regression tests for the two fixes that merged without their own
coverage — prev() across a CDATA section (#56) and escape(::SubString) (#60).
mathieu17g added a commit that referenced this pull request Jun 24, 2026
Regression tests for already-shipped fixes, plus one clear-error addition:

- BOM decode (read path): UTF-16 LE/BE + UTF-8 BOM each decode to <a/> (guards _normalize_bom).
- escape(SubString): #60 — escape was String-specialized; the AbstractString fix is now pinned.
- UTF-16 without a BOM: _normalize_bom now raises "UTF-16 without a BOM is not well-formed (XML 1.0
  §4.3.3)" when no BOM matched but a NUL byte sits in the first two positions. Previously :structural
  still rejected it, but with a cryptic "invalid element name" (interleaved NULs derail tokenization);
  this names the real cause. Two comparisons, not an O(n) isvalid(String) scan.

The UTF-16-no-BOM tests assert the clear §4.3.3 message specifically — a bare @test_throws would
false-pass since :structural already throws.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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