Comparing the results of id3tag to the results of taglib: 3 potential bugs

Xavier Duret xaviour.maillists at gmail.com
Fri Jan 12 14:29:26 CET 2007


> Here is the tag extracted from one of the files that has trailing
> space in the different fields.
> 006f:bba0 ac c8 48 89 5f fe 04 d2 05 54 41 47 42 69 67 20 ¬ÈH._þ.Ò.TAGBig
> 006f:bbb0 4c 69 65 20 53 6d 61 6c 6c 20 57 6f 72 6c 64 20 Lie Small World
> 006f:bbc0 20 20 20 20 20 20 20 20 20 20 53 74 69 6e 67 20           Sting
> 006f:bbd0 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
> 006f:bbe0 20 20 20 20 20 20 20 20 42 72 61 6e 64 20 4e 65         Brand Ne
> 006f:bbf0 77 20 44 61 79 20 20 20 20 20 20 20 20 20 20 20 w Day
> 006f:bc00 20 20 20 20 20 20 31 39 39 39 20 20 20 20 20 20       1999
> 006f:bc10 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
> 006f:bc20 20 20 20 20 20 20 20 20 0d                              .
>
> Brian was wrong. It is a problem of difference of interpretation of
> ID3v1.1 between whatever junk produced this file and taglib. The
> question is should taglib handle it gracefully.
>
The following patch fixes the problem:
----------------------------------------------------------------------------------------------------------
diff -ruN  taglib/mpeg/id3v1/id3v1tag.cpp.old taglib/mpeg/id3v1/id3v1tag.cpp
--- taglib/mpeg/id3v1/id3v1tag.cpp.old  2007-01-12 14:21:17.000000000 +0100
+++ taglib/mpeg/id3v1/id3v1tag.cpp      2007-01-12 14:27:40.000000000 +0100
@@ -55,7 +55,7 @@

 String ID3v1::StringHandler::parse(const ByteVector &data) const
 {
-  return String(data, String::Latin1);
+  return String(data, String::Latin1).stripWhiteSpace();
 }

 ByteVector ID3v1::StringHandler::render(const String &s) const
@@ -63,6 +63,8 @@
   return s.data(String::Latin1);
 }

+ID3v1::StringHandler::~StringHandler() {}
+
 ////////////////////////////////////////////////////////////////////////////////
 // public methods
 ////////////////////////////////////////////////////////////////////////////////


More information about the taglib-devel mailing list