0

Fixes for locale issues

There were some problems when a level.dat contained a non-ascii name, or
when a level.dat lived in a directory with a non-ascii name.

Paths returned by os.listdir are encoded, so we need to decode them
before printing them.  When calculating the max length of the enumerated
world names, were we for some reason calling str() before taking the
len().  The had the effect of converting unicode strings into
non-unicode strings, which is not the correct thing to do.
This commit is contained in:
Andrew Chin
2014-02-16 13:35:16 -05:00
parent b88ce263bc
commit c7ee8560d3
2 changed files with 5 additions and 3 deletions

View File

@@ -525,7 +525,7 @@ def list_worlds():
print("Detected saves:")
# get max length of world name
worldNameLen = max([len(str(x)) for x in worlds] + [len("World")])
worldNameLen = max([len(x) for x in worlds] + [len("World")])
formatString = "%-" + str(worldNameLen) + "s | %-8s | %-8s | %-16s | %s "
print(formatString % ("World", "Size", "Playtime", "Modified", "Path"))