[Python-Dev] PEP 383: Non-decodable Bytes in System Character Interfaces

Cameron Simpson cs at zip.com.au
Sat Apr 25 06:22:47 CEST 2009

On 24Apr2009 18:20, Toshio Kuratomi <a.badger at gmail.com> wrote:
| Terry Reedy wrote:
| > Is NUL \0 allowed in POSIX file names?  If not, could that be used as an
| > escape char.  If it is not legal, then custom translated strings that
| > escape in the wild would raise a red flag as soon as something else
| > tried to use them.
| > 
| AFAIK NUL should be okay but I haven't read a specification to reach
| that conclusion.  Is that a proposal?  Should I go find someone who has
| read the relevant standards to find out?

NUL cannot occur in a POSIX file path, if for no other reason than that
the API uses C strings, which are NUL terminated.

So, yes, you could use NUL as an escape character if you're sure you're
never dealing with _non_POSIX pathnames:-)

Cameron Simpson <cs at zip.com.au> DoD#743

| I'm the female partner of a climber (I don't climb) and until now, I was
| under the impression that climbers are cool people, but alas, you had to
| ruin it for me.
*REAL* climbers are crude, impolite, solitary, abrupt, arrogant.  Sport
climbers are cool.
        - Rene Tio <tor at bnr.ca> in rec.climbing

More information about the Python-Dev mailing list