Skip to content

Read Doxygen XML independently of the system text encoding - #4925

Merged
vitaut merged 4 commits into
fmtlib:mainfrom
dajiaohuang:fix/4924-doxygen-xml-encoding
Sep 9, 2026
Merged

Read Doxygen XML independently of the system text encoding#4925
vitaut merged 4 commits into
fmtlib:mainfrom
dajiaohuang:fix/4924-doxygen-xml-encoding

Conversation

@dajiaohuang

Copy link
Copy Markdown
Contributor

Fixes #4924.

Open the three Doxygen XML streams in binary mode so ElementTree decodes their declared encoding instead of Python's default text codec. This fixes local documentation generation under Windows cp1252 without requiring PYTHONUTF8=1.

Adds three unittest regressions for header, compound and namespace loading. They exercise the handler with UTF-8 XML and a simulated cp1252 default, without running Doxygen or depending on the host locale. All three fail with UnicodeDecodeError before the fix and pass afterward.

Validation:

  • python -B -X utf8=0 -m unittest discover -s support/python/tests -v: 3 passed, using the pinned documentation environment.
  • python -X utf8=0 support/mkdocs build --site-dir <output>: passed on Windows with Doxygen 1.18.0 and PYTHONUTF8=0. The existing unrelated chrono-anchor warning remains.
  • Ruff check on both changed Python files, Ruff format check on the new test, and git diff --check pass.

No dependency, CI, C++ API, or release changes. The separate locale-description PR #4923 is unaffected.

@dajiaohuang
dajiaohuang requested a review from vitaut as a code owner September 5, 2026 09:12

@vitaut vitaut left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The fix looks good, but the regression tests seem like overkill for this. Let's drop them together with open calls (see the inline comment).

Comment thread support/python/mkdocstrings_handlers/cxx/__init__.py Outdated
@vitaut
vitaut merged commit d566765 into fmtlib:main Sep 9, 2026
47 checks passed
@vitaut

vitaut commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Merged, thank you!

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.

C++ docs handler reads UTF-8 Doxygen XML using the system text encoding

2 participants