moumar / ruby-mp3info

ruby-mp3info read low-level informations and manipulate tags on mp3 files.
http://rdoc.info/github/moumar/ruby-mp3info/master/frames
223 stars 57 forks source link

Extra null in v2 comment tags with iso-8859-1 encoding #65

Open alastair opened 8 years ago

alastair commented 8 years ago

I'm having trouble using mp3info 0.8.9 to read a particular comment tag. Here's the contents of the tag:

0000030: 3543 4f4d 4d00 0000 0f00 0000 656e 6700  5COMM.......eng.
0000040: 456e 676c 616e 640d 0a00 5444 4154 0000  England...TDAT..

The tag version is 2.3. According to the spec (http://id3.org/id3v2.3.0#Comments), this should turn into:

43 4f4d 4d - COMM 00 0000 0f - size (15) 00 00 - flags 00 - encoding (iso-8859-1) 656e 67 - eng (language) 00 - short description (Terminated strings are terminated with $00 if encoded with ISO-8859-1 and $00 00 if encoded as unicode.) 456e 676c 616e 640d 0a - England\r\n 00 - terminator 5444 4154 - TDAT, next tag

from encoding to the last terminator is 15 bytes, according to size.

However, when I read this file, I get this:

[42] pry(main)> m.tag2["COMM"]
=> "England\r\n\u0000"
[43] pry(main)> m.tag.comments
=> "England\r\n\u0000"

which includes the null at the end of the tag.

I don't see this null in other id3 readers. I don't think it should be here.

Let me know if you need more information. I can't upload this mp3, but perhaps I can create a small test case which also reproduces it