◐ Shell
clean mode source ↗

Message 111342 - Python tracker

Daniele: never mind, you already said you are on OSX 10.4.

The current behavior is only a problem when the system default encoding as implied by LANG is different from the fileystem encoding.

How to fix this is an entirely different question: most (all?) unix tools just work with byte-strings and pass those through unmodified, this means that with something like:

   subprocess.Popen(['ls', snowman])

The snowman character should be encoded using the filesystem encoding, as that is the bytestring that the C APIs that ls calls expect.

Note that encoding using the preferred encoding would result in an exception, as the snowman character cannot be encoded in ASCII or even latin1.

A possible workaround is to use the CFStringGetSystemEncoding from CoreFoundation to get the system encoding when LANG=C (and probably guarded by to be activate only on OSX releases before 10.5).

Another workaround: upgrade from OSX 10.4 to at least OSX 10.5 ;-)