Skip to content

[collector]bugfix: honor XML response charset#4167

Merged
tomsun28 merged 2 commits into
apache:masterfrom
hutiefang76:codex/fix-http-xml-charset
Jul 4, 2026
Merged

[collector]bugfix: honor XML response charset#4167
tomsun28 merged 2 commits into
apache:masterfrom
hutiefang76:codex/fix-http-xml-charset

Conversation

@hutiefang76

Copy link
Copy Markdown
Contributor

What's changed

Close #2852.

  • Decode XML HTTP responses with the charset from Content-Type when present.
  • Fall back to the XML declaration charset before using UTF-8.
  • Keep non-XML response parsing behavior unchanged.
  • Add regression coverage for ISO-8859-1 XML without an HTTP charset and unsupported XML charset fallback.

Verification

  • JAVA_HOME=$(/usr/libexec/java_home -v 25 2>/dev/null || /usr/libexec/java_home) ./mvnw -pl hertzbeat-collector/hertzbeat-collector-basic -am -Dtest=HttpCollectImplTest -Dsurefire.failIfNoSpecifiedTests=false test
  • JAVA_HOME=$(/usr/libexec/java_home -v 25 2>/dev/null || /usr/libexec/java_home) ./mvnw -pl hertzbeat-collector/hertzbeat-collector-basic -am test
  • git diff --check

@tomsun28 tomsun28 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍

@tomsun28 tomsun28 merged commit 375ee54 into apache:master Jul 4, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] HttpCollectImpl XML parsing assumes UTF-8

2 participants