1. Travis Shirk
  2. eyeD3
  3. Issues
Issue #54 resolved

'utf16' codec issue on mp3 tag

ibrkanac
created an issue

on my mp3 file I get this error I can provide mp3 file

Uncaught exception: 'utf16' codec can't decode byte 0x00 in position 22: truncated data

eyed3:ERROR: 'utf16' codec can't decode byte 0x00 in position 22: truncated data
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/eyed3/main.py", line 282, in <module>
    retval = mainFunc(args, config)
  File "/usr/local/lib/python2.7/site-packages/eyed3/main.py", line 51, in main
    fs_encoding=args.fs_encoding)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/eyed3/utils/__init__.py", line 109, in walk
    handler.handleFile(os.path.abspath(path))
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/eyed3/plugins/classic.py", line 406, in handleFile
    super(ClassicPlugin, self).handleFile(f, tag_version=parse_version)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/eyed3/plugins/__init__.py", line 172, in handleFile
    self.audio_file = core.load(f, *args, **kwargs)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/eyed3/core.py", line 82, in load
    return mp3.Mp3AudioFile(path, tag_version)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/eyed3/mp3/__init__.py", line 165, in __init__
    core.AudioFile.__init__(self, path)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/eyed3/core.py", line 214, in __init__
    self._read()
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/eyed3/mp3/__init__.py", line 171, in _read
    tag_found = self._tag.parse(file_obj, self._tag_version)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/eyed3/id3/tag.py", line 98, in parse
    tag_found, padding = self._loadV2Tag(fileobj)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/eyed3/id3/tag.py", line 130, in _loadV2Tag
    self.extended_header)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/eyed3/id3/frames.py", line 1377, in parse
    frame = createFrame(tag_header, frame_header, data)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/eyed3/id3/frames.py", line 1468, in createFrame
    frame.parse(data, frame_header)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/eyed3/id3/frames.py", line 289, in parse
    self.text = decodeUnicode(self.data[1:], self.encoding)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/eyed3/id3/frames.py", line 1475, in decodeUnicode
    return unicode(bites, codec).rstrip(b"\x00")
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/utf_16.py", line 16, in decode
    return codecs.utf_16_decode(input, errors, True)
UnicodeDecodeError: 'utf16' codec can't decode byte 0x00 in position 22: truncated data