Closed tkem closed 9 years ago
:+1:
The exception is actually raised in sorted(os.listdir(...))
, since os.listdir
returns byte strings on Python 2 if the file name cannot be decoded, and sorted
tries to decode using ascii
for mixed string sequences. Or so it seems.
Currently, if a directory path cannot be decoded when browsing "Folders", an exception is raised, and the parent folder will appear to be empty. This is usually the case when mopidy is running with the "POSIX" locale, i.e. an incomplete/erroneous locale setup (such as on Pi MusicBox RC5.1). It might be better to follow the json library, and explicitly decode directory paths (and probably track names) using
sys.getfilesystemencoding()
witherrors=replace
. Note that this will not automagically provide support for Unicode directory paths, but will result in less cryptic behavior (i.e. users who see non-ASCII characters replaced with something funny are more likely to look into locale and filesystem settings).