VMD import fails if string ends with the first byte of sjis character
iRi-E opened this issue · comments
iRi-E commented
Some vmd files have a broken multibyte string which ends with the first byte of a sjis character.
Such files cause UnicodeDecodeError so the import fails.
For example, I got the following traceback when importing "こっち向いてBabyキオゴスミク.vmd":
Traceback (most recent call last):
File "/home/irie/.config/blender/2.65/scripts/addons_extern/mmd_tools/__init__.py", line 79, in execute
importer = import_vmd.VMDImporter(filepath=self.filepath, scale=self.scale)
File "/home/irie/.config/blender/2.65/scripts/addons_extern/mmd_tools/import_vmd.py", line 17, in __init__
self.__vmdFile.load(filepath=filepath)
File "/home/irie/.config/blender/2.65/scripts/addons_extern/mmd_tools/vmd.py", line 165, in load
self.header.load(fin)
File "/home/irie/.config/blender/2.65/scripts/addons_extern/mmd_tools/vmd.py", line 24, in load
self.model_name = _toShiftJisString(struct.unpack('<20s', fin.read(20))[0])
File "/home/irie/.config/blender/2.65/scripts/addons_extern/mmd_tools/vmd.py", line 14, in _toShiftJisString
return byteString.decode("shift_jis")
UnicodeDecodeError: 'shift_jis' codec can't decode byte 0x88 in position 18: incomplete multibyte sequence