Closed hank closed 6 years ago
Hi @hank, sorry for the late response!
Nevermind the 'ascii' encoding error for now, that is thrown by the logger failing to report the original error. As for that, it looks like the filename got (en|de)coded wrong: there's a couple of wrong unicode characters in that path. The error output makes it seem like each of the three UTF-8 bytes for the quotation mark (\xe2\x80\x99
) somehow ended up as two-byte UTF-16 low surrogates.
In Python 3, CherryMusic doesn't decode filenames itself, it just concatenates output from os.listdir(...)
. So, to diagnose:
>>> import os
>>> os.chdir('/PATH/TO/MUSIC/Albums/Lindsey Stirling/Lindsey Stirling (V0)')
>>> # decoded to unicode:
>>> [x for x in os.listdir('.') if x.startswith('02 Zi')]
>>> # check actual bytes:
>>> [b for b in os.listdir(b'.') if b.startswith(b'02 Zi')]
>>> import sys
>>> sys.getfilesystemencoding()
$ ./cherrymusic --info
?So, I think we have a duplicate of #595 at our hands. @hank, I'm leaving this ticket open for now because I want to be sure to get your response. I suspect it might be very useful in pinning down this bug. We'll eventually do so over in the other ticket. :hatched_chick:
I thought I fixed this in the code, but git tells me I made no changes - weird...
If I figure it out, I'll let you know. I think I just changed an encode() to a decode() and voila! Sorry about that.
@hank Could you find out about the stuff I asked above? It would be useful, I think.
Ran into this today:
The filename is as follows: 02 Zi-Zi’s Journey.mp3
The single quote is a UTF-8 curly: http://www.fileformat.info/info/unicode/char/2019/index.htm Unicode Character 'RIGHT SINGLE QUOTATION MARK' (U+2019)
It's a good test case to make sure UTF8 works. Let me know if I can help - I'm halfway decent at python. Using latest trunk.