taglib library

Scott Wheeler wheeler at kde.org
Thu Oct 28 10:03:31 CEST 2004


On Thursday 28 October 2004 8:23, FERME paul-henri wrote:
> Hi scott,
> 
> we started using taglib as part of the upcoming release of prokyon3 and 
> everybody notice a clear speed improvement against id3lib.
> As a matter of fact we plan to  make it "the" default prokyon3 library for 
> tagging.
> 
> One of the change we want to implement in our code is improve international 
> support. By that we mean using codec defined by your locale settings, as 
> defined in the QT library.
> 
> Is taglib using this locale text codect when writing to music file?
>
> For example, when you write a tag to an mp3 file you could encoded either in 
> utf8 or latin1 in our case (french and german mostly..)
> Will taglib autmatically use your locale  selection?
> Is there a way to select/force this encoding from the api?

ID3v1 technically isn't supposed to contain anything other than ISO-8859-1 
("Latin 1").  Granted, that doesn't stop some applications putting non-Latin1 
data in them, but that's actually incorrect.

For handling such it is possible to override the default behavior in TagLib in 
case you want to force it to use the current locale while reading or writing.

The API for such is here:

http://developer.kde.org/~wheeler/taglib/api/classTagLib_1_1ID3v1_1_1StringHandler.html

And there's an example here:

http://ktown.kde.org/~wheeler/files/more-taglib-examples/string-handler-utf8.cpp

ID3v2 has a fixed set of supported codecs (Latin1, UTF-16, UTF-8) and TagLib 
supports all of those.  You can set the default using 
TagLib::ID3v2::FrameFactory::setDefaultTextEncoding(), covered here:

http://developer.kde.org/~wheeler/taglib/api/classTagLib_1_1ID3v2_1_1FrameFactory.html

Hope that helps.  I've also CC'ed this on the taglib-devel list since that 
makes it easier for me to point to this answer in the future if someone asks 
the same question.  :-)  It's probably a good idea to send followups there as 
well.

Cheers,

-Scott


More information about the taglib-devel mailing list