Skip to content

Handle GPX byte-order marks and XML encodings - #194

Merged
jenetics merged 1 commit into
jenetics:releases/r4.0.1from
bensynapse:fix-gpx-byte-order-mark
Sep 18, 2026
Merged

jenetics merged 1 commit into
jenetics:releases/r4.0.1from
bensynapse:fix-gpx-byte-order-mark

Conversation

@bensynapse

Copy link
Copy Markdown
Contributor

I run Live Tennis API.

Fixes #190. GPX.read(Path) rejects the supplied UTF-8 BOM file because InputStreamReader turns its encoding marker into prolog text before StAX sees it. Pass byte streams directly to the XML parser through the existing non-closing wrapper, allowing it to consume byte-order marks and honor declared encodings. Use StringReader for fromString so already-decoded text keeps its existing behavior.

Validation on Linux with Temurin 25:

  • ./gradlew build --stacktrace --info passes all 1,000 tests and builds the library, source and Javadoc JARs.
  • Four encoding regressions fail before the fix and pass afterward. Coverage includes stream/path reads, UTF-8 with/without BOM, UTF-16 in both byte orders, declared Latin-1, decoded strings, and leaving caller-owned streams open on success and failure.
  • Both original attachments from GPX.read cannot handle Files with BOM #190 produce identical GPX objects with the built JAR, including all 1,798 track points; the BOM attachment fails on upstream.

@jenetics
jenetics changed the base branch from master to releases/r4.0.1 September 18, 2026 17:29
@jenetics
jenetics merged commit ca5f708 into jenetics:releases/r4.0.1 Sep 18, 2026
2 checks passed
@jenetics

Copy link
Copy Markdown
Owner

@bensynapse Thank you for the fix.

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.

GPX.read cannot handle Files with BOM

2 participants