This update of the previous patch also get rid of trailing zeros that are allowed in ID3v2.3. Trailing zeros is not a common behavior but I do have an example of it. diff -ruN taglib.old/taglib/mpeg/id3v2/frames/textidentificationframe.cpp taglib/taglib/mpeg/id3v2/frames/textidentificationframe.cpp --- taglib.old/taglib/mpeg/id3v2/frames/textidentificationframe.cpp 2007-01-17 16:01:34.000000000 +0100 +++ taglib/taglib/mpeg/id3v2/frames/textidentificationframe.cpp 2007-01-19 14:40:56.000000000 +0100 @@ -94,16 +94,26 @@ void TextIdentificationFrame::parseFields(const ByteVector &data) { + ByteVector fixedData; + uint i = 0; + // read the string data type (the first byte of the field data) d->textEncoding = String::Type(data[0]); + int byteAlign = d->textEncoding == String::Latin1 || d->textEncoding == String::UTF8 ? 1 : 2; + + // Strip trailing zeros for ID3v2.3 + + while((itextEncoding == String::Latin1 || d->textEncoding == String::UTF8 ? 1 : 2; - - ByteVectorList l = ByteVectorList::split(data.mid(1), textDelimiter(d->textEncoding), byteAlign); + ByteVectorList l = ByteVectorList::split(fixedData.mid(1), textDelimiter(d->textEncoding), byteAlign); d->fieldList.clear(); On 1/17/07, Xavier Duret wrote: > ID3v2.3 specifies that text information frames can be NULL terminated > (see section 4.2). The encoding of the strings themselves are > specified in section 3.3. This means that a frame like "54 52 43 4b 00 > 00 00 03 00 00 00 31 00 TRCK.......1." actually contains a single NULL > terminated string. > This patch makes ID3v2.3 text information frames behave like ID3v2.4 > which in turn ensures that the parsing of "TRCK" tag works properly > (in the example, return 1 instead of 0). _______________________________________________ taglib-devel mailing list taglib-devel@kde.org https://mail.kde.org/mailman/listinfo/taglib-devel