Closed fossfreedom closed 10 years ago
Thanks for letting me know about this - I'll look into it later today!
So, all comment data has to be UTF-8 encoded, and according to http://wiki.xiph.org/VorbisComment#Cover_art, the picture should be base64 encoded within the VorbisComment... You seem to be doing this correctly.
Just checked and the output of base64.b64encode in Python 3 is bytes. I think the problem here is the validation and writing of UTF-8 byte strings in mutagenx. In Python 2, str.encode and unicode.encode both existed - str.encode('utf-8') did nothing if the string was already UTF-8. So I'll have to update the validation and writing code to handle bytes specifically - perhaps a UTF-8 decode followed by a UTF-8 encode.
Ok, I've committed a fix to this repo - not currently planning to put it on PyPI for another few days, so if you need it urgently, get it from here.
Alternatively, for now you should be able to get around it by doing:
base64.b64encode(data).decode("utf-8")
which'll pass in a Unicode value to be verified.
absolutely superb!
Many many thanks. The fixes work great. Cheers :)
Hi,
thanks for your port - this is a quick query hopefully. I'm using your 1.22 branch.
I've got a jpg which I'm attempting to write to an OggVorbis file
snippet:
where art_location is pointing to a valid jpeg file location.
in python2 I would use "image.data = open(art_location, "r").read()" - this snippet would work. In python3 - this would fail with "UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte"
Thus - I'm reading as binary.
However when writing the tag this error occurs:
snippet:
Any thoughts on how to resolve this?