bpo-34523: Py_DecodeLocale() use UTF-8 on Windows by vstinner · Pull Request #8998 · python/cpython
Py_DecodeLocale() and Py_EncodeLocale() now use the UTF-8 encoding on
Windows if Py_LegacyWindowsFSEncodingFlag is zero.
pymain_read_conf() now sets Py_LegacyWindowsFSEncodingFlag in its
loop, but restore its value at exit.