alastair/python-musicbrainz-ngs — pull request #103 by JonnyJD (2013-04-21 19:00:02+00:00)
Title: Authentication using non-ascii password not working

This is the upstream report for JonnyJD/musicbrainz-isrcsubmit#58.

Summary:
It is a bit vague how this is supposed to work in general, but working with the musicbrainz server using the "latin1" encoding seems to work.
For Python 2 we can just force the encoding of `password` (and potentially `user`) to "latin1".
On Python 3 these are supposed to be unicode and will be decoded to unicode in urllib. Subclassing `HTTPDigestAuthHandler` could work.

One could argue if this is an upstream urllib bug or not.
We should at least try to submit it. This needs a bit preparation, though.

There is a test script available at:
https://gist.github.com/JonnyJD/5429281 (password_test.py)
You either have an account on musicbrainz.org with non-ascii characters or you can change the hostname in the top of the file to test.musicbrainz.org and fix somehting up there.
The Python 2 case is fixed in the test script already, but this should be implemented in python-musicbrainz-ngs instead.