[Python-Dev] a suggestion ... Re: PEP 383 (again)

Thomas Breuel tmbdev at gmail.com
Thu Apr 30 14:59:55 CEST 2009


>
> And then it goes on to say: "You won't be able to pass non-Unicode
> filenames as command-line arguments."(*)  Not only that, but you can't
> reliably use such files with System.IO (whatever that is, but it
> sounds pretty basic).  This support is only available "within the
> Mono.Unix and Mono.Unix.Native namespaces".  Now, I don't know what
> that means (never having touched Mono), but it doesn't sound like
> it simplifies cross-platform support, which is what PEP 383 is aiming for.


The problem there isn't how the characters are quoted, but that they are
quoted at all, and that the ECMA and Microsoft libraries don't understand
this quoting convention.  Since command line parsing is handled through
ECMA, you happen not to be able to get at those files (that's fixable, but
why bother).

The analogous problem exists with Martin's proposal on Python: if you pass a
unicode string from Python to some library through a unicode API and that
library attempts to open the file, it will fail because it doesn't use the
proposed Python utf-8b decoder.  There just is no way to fix that, no matter
which quoting convention you use.

In contrast to PEP 383, quoting with u0000 at least results in valid unicode
strings in Python.  And command line arguments (and environment variables
etc.) would work in Python because in Python, those should also use the new
encoding for invalid UTF-8 inputs.

Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20090430/96c06a45/attachment.htm>


More information about the Python-Dev mailing list