birdman
Moderator
Why would the encode be needed? Isn't name starting as a bytes item (given that this is the only data-type which can contain all valid filenames)?Avoiding the crash is simple, for example modify getItemDisplayName() to return value: name.encode('UTF-8', 'surrogateescape').decode('UTF-8', 'ignore')
What about:Now question is what name / characters it should display to user? But I think display problem is only minor issue here.
Code:
name.decode(encoding='utf8', errors='backslashreplace')