[issue8514] Create fsencode() and fsdecode() functions in os.path

STINNER Victor report at bugs.python.org
Mon Apr 26 12:38:00 CEST 2010


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

> They're also useful for dealing with environment variables 
> which are not strictly filesystem (fs) related but also suffer 
> from the same issue requiring surrogate escape.

Yes, Python3 decodes environment variables using sys.getfilesystemencoding()+surrogateescape. And since my last fix on os.execve(), subprocess (and os.execv(p)e) uses also surrogateescape to encode environment variables.

And yes again, I also patched os.getenv() to decode bytes name to unicode using sys.getfilesystemencoding()+surrogateescape.

> But other than just calling these os.encode and os.decode

*fs*encode() and *fs*decode() is a reference to the encoding: sys.get*filesystem*encoding().

> I just wanted to point the other use out

See also issue #8513.

----------

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


More information about the Python-bugs-list mailing list