[issue29241] sys._enablelegacywindowsfsencoding() don't apply to os.fsencode and os.fsdecode

JGoutin report at bugs.python.org
Thu Jan 12 02:07:47 EST 2017


JGoutin added the comment:

import sys

# Force the use of legacy encoding like versions of Python prior to 3.6.
sys._enablelegacywindowsfsencoding()

# Show actual file system encoding
encoding = sys.getfilesystemencoding()
print('File system encoding:', encoding)

# os.fsencode(filename) VS filename.encode(File system encoding)
import os
print(os.fsencode('é'), 'é'.encode(encoding))

>>> File system encoding: mbcs
>>> b'\xc3\xa9' b'\xe9'


The result is the same.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29241>
_______________________________________


More information about the Python-bugs-list mailing list