Sphinx: Specify encoding when opening files for title extraction

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. Use the locale from the
document settings instead, which should better match the file's
encoding.

Fixes: #24679
1 file changed