You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using beet with tomahawk. If I try to play a song with CJK character in its name, the web server throws UnicodeEncodeError.
127.0.0.1 - - [22/Feb/2018 15:28:19] "GET /item/10933/file HTTP/1.0" 200 -
Error on request:
Traceback (most recent call last):
File "/usr/local/Cellar/pyenv/1.2.1/versions/3.6.4/lib/python3.6/site-packages/werkzeug/serving.py", line 270, in run_wsgi
execute(self.server.app)
File "/usr/local/Cellar/pyenv/1.2.1/versions/3.6.4/lib/python3.6/site-packages/werkzeug/serving.py", line 261, in execute
write(data)
File "/usr/local/Cellar/pyenv/1.2.1/versions/3.6.4/lib/python3.6/site-packages/werkzeug/serving.py", line 227, in write
self.send_header(key, value)
File "/usr/local/Cellar/pyenv/1.2.1/versions/3.6.4/lib/python3.6/http/server.py", line 508, in send_header
("%s: %s\r\n" % (keyword, value)).encode('latin-1', 'strict'))
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 46-50: ordinal not in range(256)
Here's a song that can cause this problem (fields dumped with the export plugin):
Hello! Thanks for the details. Because this error happens when sending the headers, I suspect that the problem only occurs because there are non-Latin1 characters in the filename (not just in the metadata). Can you confirm that the filename has CJK characters?
This seems like a Python 3 specific issue. It works fine for me with Python 2.7 and Chromium. In Python 3, it even occurs on characters like single right quotation marks (u2019), that can be found in filenames pretty often. This could possibly be prevented by "de-asciifying" the attachment_filename or taking a fallback filename. Is that an option?
Thanks! Yeah, it seems like the right thing to do is to ASCIIfy the filename. (For clues about how to do this, see the uses of unidecode elsewhere in the codebase.)
sampsyo
added
bug
bugs that are confirmed and actionable
python 3
Arises from the Python 2->3 transition.
and removed
needinfo
We need more details or follow-up from the filer before this can be tagged "bug" or "feature."
labels
Mar 1, 2018
sampsyo
changed the title
Web plugin throws UnicodeEncodeError on non-latin characters.
web: UnicodeEncodeError on non-latin1 characters in filename
Mar 1, 2018
Problem
I'm using beet with tomahawk. If I try to play a song with CJK character in its name, the web server throws
UnicodeEncodeError
.Here's a song that can cause this problem (fields dumped with the
export
plugin):Setup
The text was updated successfully, but these errors were encountered: