Skip to content

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

Open
dajiaohuang wants to merge 2 commits into
fmtlib:mainfrom
dajiaohuang:fix/4924-doxygen-xml-encoding
Open

Read Doxygen XML independently of the system text encoding#4925
dajiaohuang wants to merge 2 commits into
fmtlib:mainfrom
dajiaohuang:fix/4924-doxygen-xml-encoding

Conversation

@dajiaohuang

Copy link
Copy Markdown

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
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

1 participant