Skip to content

Commit

Permalink
Fix unicode file names handling
Browse files Browse the repository at this point in the history
  • Loading branch information
canepan authored Apr 30, 2021
1 parent c64ace5 commit abe5fdb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions duviz.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ def get_progress_reporter(max_interval=1, terminal_width=80, write=sys.stdout.wr
def progress(info: str):
nonlocal next_time, interval
if time() > next_time:
write(info.ljust(terminal_width)[:terminal_width] + '\r')
write(info.encode('ascii', errors='replace').ljust(terminal_width)[:terminal_width] + '\r')
next_time = time() + interval
# Converge to max interval.
interval = 0.9 * interval + 0.1 * max_interval
Expand Down Expand Up @@ -552,7 +552,7 @@ def main():
else:
renderer = AsciiDoubleLineBarRenderer(max_depth=opts.max_depth, size_formatter=size_formatter)

print("\n".join(renderer.render(tree, width=opts.display_width)))
print("\n".join(renderer.render(tree, width=opts.display_width)).encode('ascii', errors='replace').decode('ascii'))


if __name__ == '__main__':
Expand Down

0 comments on commit abe5fdb

Please sign in to comment.