-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Always return Unicode strings #85
Comments
This is a good idea, I can't remember if we talked about it. The fact that elementtree returns both is annoying. My preference would be for a helper method to use in the parse_element methods - either explicit or a decorator. |
Moving this to apichange. Do we think that it's an incompatible change, or can we just do it? |
I consider this an apichange. People might run into problems expecting a bytestring at some point, trying to do some decoding and failing since you can't decode a (non-ascii) unicode string. Example in mind:
Something like that. |
OK, good reason to hold off for apichange. Thanks. |
Just checked this now and it seems like this issue is not coming up anymore, so this issue may be closed I think [ins] In [13]: rec = musicbrainzngs.search_recordings(artist='alt-j', recording='piano', limit=1)['recording-list'][0]
[ins] In [14]: rec["title"]
Out[14]: '❦ (Piano)'
[ins] In [15]: rec["release-list"][0]["title"]
Out[15]: 'An Awesome Wave' |
I noticed recently that the strings returned from our library are sometimes bytes and sometimes Unicode. Due to ElementTree's default behavior, only those strings that are non-ASCII are returned as Unicode objects. For example:
The recording title, which has a "special" character in it, is a
unicode
object. The release title, which is all ASCII, is astr
object. For consistency's sake (and for an eventual Python 3 port), the library should always returnunicode
objects.Anyone have any bright ideas about the best way to go about addressing this? (I have a nagging sensation that we might have discussed this in the past, but I can't remember if we came to a conclusion about what to do.)
The text was updated successfully, but these errors were encountered: