Add `encoding` parameter to {read,write}_text (PEP 597).
With the introduction of PEP 597, relying on the default value of
encoding
for functions that read/write files is no longer recommended,
and developers have been incentivised to run tests using
PYTHONWARNDEFAULTENCODING=1
to identify when the encoding
argument
is not given.
As a result, when PYTHONWARNDEFAULTENCODING=1
is set on the CI
environment responsible for building the docs, sphinx_reredirects
will emit a EncodingWarning: 'encoding' argument not specified
.
The objective of this change is to comply with the PEP's recommendations
and avoid the EncodingWarning
from being emitted.