Message361539
One of sys._enablelegacywindowsfsencoding() issue is that os.fsdecode() and os.fsencode() are not updated, they continue to use UTF-8. Example on Windows:
>>> import sys, os
>>> sys.getfilesystemencoding()
'utf-8'
>>> os.fsencode('\xe9')
b'\xc3\xa9'
>>> sys._enablelegacywindowsfsencoding()
>>> sys.getfilesystemencoding()
'mbcs'
>>> os.fsencode('\xe9')
b'\xc3\xa9'
See bpo-29241 for larger issues caused by this function.
--
The first reason is deprecate this function is that it sounds dangerous to me and it doesn't seem to be used.
I only found one project which used it temporarily until they fixed their code to encode/decode filenames on Windows. It was used to workaround a in bug in their code. |
|
Date |
User |
Action |
Args |
2020-02-07 08:12:22 | vstinner | set | recipients:
+ vstinner, paul.moore, tim.golden, zach.ware, eryksun, steve.dower, ZackerySpytz |
2020-02-07 08:12:22 | vstinner | set | messageid: <1581063142.91.0.782326965925.issue37413@roundup.psfhosted.org> |
2020-02-07 08:12:22 | vstinner | link | issue37413 messages |
2020-02-07 08:12:22 | vstinner | create | |
|