'The MusicBrainz server also accepts UTF-8 encoded passwords.'

def _encode_utf8(self, msg):

    encoding = (sys.stdin.encoding or locale.getpreferredencoding())
    try:
        msg = msg.decode(encoding)
    except AttributeError:
        pass
    return msg.encode('utf-8')
