[Python-Dev] PEP 383: Non-decodable Bytes in System Character Interfaces (original) (raw)

Benjamin Peterson benjamin at python.org
Tue Apr 28 03:09:10 CEST 2009


2009/4/27 Cameron Simpson <cs at zip.com.au>:

I think that, almost independent of this PEP, there should be an os.fsencode() function that takes a byte string (as a POSIX OS call will take) and performs the same byte->string encoding that listdir() and friends are doing under the hood. And a partner os.fsdecode() for string->bytes. That will save a lot of wheel respoking and probably make it easier for people to think about this.

some_path.encode(sys.getfilesystemencoding())

-- Regards, Benjamin



More information about the Python-Dev mailing list