Python does some UTF-8 coercion, because it wants its runtime
to be UTF-8 where possible. You can read about it here:
PEP 538 – Coercing the legacy C locale to a UTF-8 based locale
https://peps.python.org/pep-0538/
I wonder whether SWI-Prolog could also work towards something
like that, so that code page change becomes unnecessary. Otherwise
there might a divergence between SWI-Prolog and Python:
“However, it comes at the cost of making CPython’s encoding assumptions
diverge from those of other locale-aware components in the same process,
as well as those of components running in subprocesses that share
the same environment.”
– PEP 538
But I didn’t test that far yet. i.e. cannot yet pin point some issues,
since the Python bundling for SWI-Prolog is new.