I am on python 2.6 for Windows.
I use os.walk to read a file tree. Files may have non-7-bit characters (German \"ae\" for example) in their filenames. These are enco
os.walk isn't specified to always use os.listdir, but neither is it listed how Unicode is handled. However, os.listdir does say:
Changed in version 2.3: On Windows NT/2k/XP and Unix, if path is a Unicode object, the result will be a list of Unicode objects. Undecodable filenames will still be returned as string objects.
Does simply using a Unicode argument work for you?
for dirpath, dirnames, filenames in os.walk(u"."):
print dirpath
for fn in filenames:
print " ", fn