[Python-Dev] Python-3.0, unicode, and os.environ

Adam Olsen rhamph at gmail.com
Fri Dec 5 05:42:10 CET 2008

On Thu, Dec 4, 2008 at 8:55 PM,  <glyph at divmod.com> wrote:
> On 02:32 am, rhamph at gmail.com wrote:
>> On Thu, Dec 4, 2008 at 6:14 PM, James Y Knight <foom at fuhm.net> wrote:
>>> FWIW, I still agree with Martin that that's the most reasonable solution.
>> It died because nobody presented a viable solution, and I maintain no
>> solution is possible.  All suggestions involve arbitrary
>> transformations that fail to round trip correctly at some point or
>> another.  They're simply about shuffling the failure around to
>> somewhere the poster happens to like.
>> Please, if you have a *new* idea that doesn't have a failure mode, by
>> all means post it.  But don't resurrect a pointless bikeshed.
> Despite my objection to the funny-encoding strategy (which I've documented
> thoroughly in my other message to this thread) this isn't accurate.  The PUA
> solution doesn't work, but using NUL does.  This was proposed last time, as
> a copy of what Mono does.  You can't get a NUL in os.environ or a filename;
> it's not valid.  So, it works fine as an escape character.  It can
> round-trip perfectly.

The failure is more subtle, in that a path from the filesystem cannot
round trip via a different return path.  i.e. list the dir via python,
pass it to an external lib to open.

If you don't need that to work it's quite easy to explicitly encode
byte strings into text for storage or whatever.

Adam Olsen, aka Rhamphoryncus

More information about the Python-Dev mailing list