[Python-Dev] PEP 383: Non-decodable Bytes in System Character Interfaces
Glenn Linderman
v+python at g.nevcal.com
Tue Apr 28 03:24:24 CEST 2009
On approximately 4/27/2009 5:42 PM, came the following characters from
the keyboard of Cameron Simpson:
> 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.
>
If a generally useful encoding scheme is invented for transforming file
names within Python, it should definitely be made available for those
cases where the application must transform between an encoded Python
name and either a str or bytes interface presented by 3rd party software.
It should be available on all platforms, so that portable code can be
written. Of course, if there are variations in the 3rd party software
on the various platforms, there still may be a need for
platform-specific code.
--
Glenn -- http://nevcal.com/
===========================
A protocol is complete when there is nothing left to remove.
-- Stuart Cheshire, Apple Computer, regarding Zero Configuration Networking
More information about the Python-Dev
mailing list