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

Adam Olsen rhamph at gmail.com
Fri Dec 5 04:47:22 CET 2008

On Thu, Dec 4, 2008 at 8:24 PM, Dino Viehland <dinov at microsoft.com> wrote:
> Does anyone know what Mono does here?  Presumably they have the exact same
> problem as all strings in .NET are Unicode, and filenames/env vars/etc...
> are always strings.
> Maybe if it's gotta be broken at least it can be broken in a manner
> that's consistent with others :)

Many of the windows APIs use UTF-16 without validating it.  They'll
pass through invalid strings until they hit something that does
validate, at which point it'll blow up.

I suspect that it doesn't happen very often in practice, as having
only one encoding makes it quite clear that it's a broken file name,
not a mixed encoding environment.

Adam Olsen, aka Rhamphoryncus

More information about the Python-Dev mailing list