Skip to content
This repository has been archived by the owner on Nov 2, 2020. It is now read-only.

ASCII encoding and wacky artist names #6

Open
mgeraci opened this issue Feb 28, 2013 · 3 comments
Open

ASCII encoding and wacky artist names #6

mgeraci opened this issue Feb 28, 2013 · 3 comments

Comments

@mgeraci
Copy link

mgeraci commented Feb 28, 2013

I've got a very simple script that prints the currently playing artist to stdout. It's failing when trying to return "Janelle Monáe" (failing on the á, I assume) with the error:

Traceback (most recent call last):
  File "scripts/now_playing.py", line 29, in <module>
    artist = sq.get_track_artist()
  File "build/bdist.macosx-10.8-intel/egg/pylms/player.py", line 266, in get_track_artist
UnicodeEncodeError: 'ascii' codec can't encode characters in position 11-12: ordinal not in range(128)

Forgive me if this is a basic question not having to do with your script (I'm not a python developer), but I do seem to be able to handle unicode in the script (print u"\u03A9" outputs Ω correctly, for example).

Thanks!

@decibyte
Copy link
Collaborator

decibyte commented Mar 5, 2013

Hi mgeraci. Thanks for reporting this. I'm not sure anyone will have the time to look at it soon, but feel free to submit a fix if you manage to create one yourself :)

@mgeraci
Copy link
Author

mgeraci commented Mar 5, 2013

Absolutely! I'm happy to give it a shot, but I'm not sure how successful I'll be. Any pointers on places in the code to look?

@thomaswwp
Copy link

I got it working (well, not crashing and putting in something vaguely like a replacement) by putting adding this unicode transformation line to server.py at line 100 in the request function,

        result = result.strip()
        result = unicodedata.normalize('NFD', result).encode('ascii','ignore')
        return result

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants