Skip to content

Sphinx, Tests: Specify encoding when opening files

Craig Scott requested to merge craig.scott/cmake:python-file-encoding into master

When the encoding is not specified, open() may choose an encoding based on the locale in use. That encoding may have no relationship to the encoding of the file being opened. When we have information about the file being opened, we should use that rather than relying on the locale happening to match. This fixes the problem where running some python scripts would fail in certain locales when processing files that have a specific encoding, such as JSON schema or RST files (always UTF-8 in the CMake repo).

Fixes: #24679 (closed)

Merge request reports