diff --git a/twander.py b/twander.py index c05dbea..a98461e 100755 --- a/twander.py +++ b/twander.py @@ -6,7 +6,7 @@ # Program Information PROGNAME = "twander" -RCSID = "$Id: twander.py,v 2.79 2003/01/23 19:44:23 tundra Exp $" +RCSID = "$Id: twander.py,v 2.80 2003/01/25 00:22:45 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -2176,7 +2176,7 @@ lowerlist = [(x.lower(), x) for x in l] lowerlist.sort() l[:] = [] - [l.append(unicode(x[1], WIN32ENCODING)) for x in lowerlist] + [l.append(x[1]) for x in lowerlist] else: dList.sort() @@ -2189,6 +2189,26 @@ dList.insert(0, ".." + PSEP) + # Save the complete list for details extraction below + # We save this now, before the unicode promotion which follows. + # A file name containting non-ASCII characters which is then + # promoted to unicode will cause the subsequent owner/group + # lookups under win32all to fail. So, we save the non-unicode + # versions here, and promote them later in the details handling. + + all = dList + fList + + # Now, we promote the file/directory names to unicode so + # they will be properly handled throughout the rest of + # the code when we are: a) Running Win32, b) Showing no + # details, and c) Have file/directory names with non-ASCII + # characters. + + if OSNAME == 'nt': + for l in (dList, fList): + for x in range(len(l)): + l[x] = unicode(l[x], WIN32ENCODING) + # The user requested Drive List View. This is always displayed # without details, so we can return directly from here. @@ -2198,7 +2218,6 @@ # Get details on directory contents - all = dList + fList detlist = [] UI.TotalSize = 0 for index in range(len(all)): @@ -2375,8 +2394,11 @@ detlist[index] += ftime + (ST_SZMTIME - len(ftime)) * " " # Add the File Name - detlist[index] += all[index] - + if OSNAME == 'nt': + detlist[index] += unicode(all[index], WIN32ENCODING) + else: + detlist[index] += all[index] + # Include symlink details as necessary if detlist[index][0] == 'l':