leosongwei / mutagen

Automatically exported from code.google.com/p/mutagen
GNU General Public License v2.0
0 stars 0 forks source link

mp4: crash when using 'unicode' object tag values #164

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Mutagen's MP4 support doesn't cope with values supplied as 'unicode' object 
(regardless of whether those values actually contain non-ASCII characters). The 
following simple program:

import sys, mutagen
tags = mutagen.File(sys.argv[1])
tags[u"----:com.apple.iTunes:testtag"] = u"test"
tags.save()

produces an exception:

Traceback (most recent call last):
  File "test.py", line 4, in <module>
    tags.save()
  File "/usr/lib/python2.7/dist-packages/mutagen/__init__.py", line 155, in save
    return self.tags.save(filename, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mutagen/mp4.py", line 362, in save
    data = Atom.render("ilst", "".join(values))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xa9 in position 4: ordinal 
not in range(128)

Removing the 'u' modifier from the u"test" bit makes it work. This error 
happens both with the only MP4/AAC file I actually had as well as sample files 
from this site:

http://download.wavetlan.com/SVV/Media/HTTP/http-aac.htm

This is with Mutagen 1.22 on Ubuntu 13.10 64-bit.

Original issue reported on code.google.com by fkrul...@gmail.com on 29 Nov 2013 at 8:38

GoogleCodeExporter commented 9 years ago
encode to utf-8 before

Original comment by reiter.christoph@gmail.com on 29 Nov 2013 at 9:30

GoogleCodeExporter commented 9 years ago
mutagen has moved to Bitbucket: https://bitbucket.org/lazka/mutagen/issue/164

Original comment by reiter.christoph@gmail.com on 4 Jul 2014 at 3:35