The C++ mkdocstrings handler opens Doxygen XML in text mode without an encoding at three sites in support/python/mkdocstrings_handlers/cxx/__init__.py (header, compound and namespace loading).
On current main 6226bc70b8e15060a21a281c5ec5f4b91be8582f, building the docs with Python's Windows cp1252 locale fails at the first header-loading site:
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 4724
The input chrono_8h.xml declares UTF-8 and contains valid UTF-8 Chinese text. The text-mode stream decodes it using the system locale before ElementTree can process the XML declaration. The same build completes with PYTHONUTF8=1.
Reproduction environment: Windows x64, repository-pinned support/doc-requirements.txt in an isolated Python environment, official Doxygen 1.18.0 on PATH. From the source root, run the environment's Python with UTF-8 mode disabled:
python -X utf8=0 support/mkdocs build --site-dir <output-directory>
Expected: generated XML is decoded according to its encoding declaration, independently of the user's default text codec. Opening each XML stream in binary mode before ET.parse would let the XML parser handle that decoding without changing the document content or dependencies.
This concerns local documentation generation, not C++ runtime formatting or the hosted Ubuntu deployment. The separate locale-description PR #4923 only changes doc/api.md; it does not fix these reads.
The C++ mkdocstrings handler opens Doxygen XML in text mode without an encoding at three sites in
support/python/mkdocstrings_handlers/cxx/__init__.py(header, compound and namespace loading).On current main
6226bc70b8e15060a21a281c5ec5f4b91be8582f, building the docs with Python's Windows cp1252 locale fails at the first header-loading site:The input
chrono_8h.xmldeclares UTF-8 and contains valid UTF-8 Chinese text. The text-mode stream decodes it using the system locale before ElementTree can process the XML declaration. The same build completes withPYTHONUTF8=1.Reproduction environment: Windows x64, repository-pinned
support/doc-requirements.txtin an isolated Python environment, official Doxygen 1.18.0 on PATH. From the source root, run the environment's Python with UTF-8 mode disabled:Expected: generated XML is decoded according to its encoding declaration, independently of the user's default text codec. Opening each XML stream in binary mode before
ET.parsewould let the XML parser handle that decoding without changing the document content or dependencies.This concerns local documentation generation, not C++ runtime formatting or the hosted Ubuntu deployment. The separate locale-description PR #4923 only changes
doc/api.md; it does not fix these reads.