Closed evetsso closed 6 years ago
The code you found is a workaround for a bug in CherryPy (the web framework we're using), that has apparently been fixed in newer versions. CherryPy didn't handle non-ASCII correctly, and we had to match its behavior. (See this other code example.)
Now we need to find all other instances of this workaround and check the CherryPy version to see if the workaround is needed.
Good thing we commented and documented all this properly. 🙄 😭 (We didn't.)
To what extent do those old cherrypy versions need to be supported?
Well, probably we can kick out all the support for those old cherrypys.
CherryMusic was always built on absolute backwards compatibility, supporting old python versions and old cherrypy versions, but I guess after a few years we can kick out all those compat-hacks.
@evetsso I'm not sure if I break anyone's cherrymusic setup by merging your PR... @tilboerner Do you have any idea what the impact might be?
@devsnd If we merge this, I think Cherrymusic will break for everybody who used the bootstrapping function to install CherryPy and who has non-ASCII pathnames. We would also need to change similar code in a few other places to make it not break for all others.
I think the alternatives are to make all instances of this encoding patch conditional on the CherryPy version, or we update the bootstrapping thing to handle a new minimum version of CherryPy.
@evetsso It took a while, but we finally merged this. Sorry for the delay!
I changed your change slightly, so instead of deleting the code, it only gets run if needed. I also messed up by creating my own commit for it (7aaa4fd6c5b88a4ba0fa3ad66775390af3736020); but I made a pro-forma merge of this PR, so you get credit. Thanks for the contribution! 🌷 🍷 🍰
On Linux with python 3 (Arch Linux on 64-bit x86 specifically) I'd get an error like this when I have transcoding enabled and I try to play a file named "01 - 媛星.flac"
On Linux at least it's a pretty safe bet that filenames are utf-8. Even on other operating systems, latin-1 seems like a dangerous thing to assume. I'm not sure I understand what the intent was, for having latin-1 in here.
With this change, things at least work for me. It seems safest to make no assumptions at all about encodings in paths, and to treat them just as bytes.