Generic API useless with Unicode for ID3v2?

Andreas Klöckner lists at informa.tiker.net
Wed Oct 17 20:49:08 CEST 2007


On Mittwoch 17 Oktober 2007, Scott Wheeler wrote:
> Andreas Klöckner wrote:
> > In particular, that means you can't reliably use the generic API with
> > Unicode data on ID3v2 files.
>
> This is all actually quite easy, if not particularly obvious from the
> API.  All you have to do is call:
>
> TagLib::ID3v2::FrameFactory::setDefaultTextEncoding(...)
>
> After that all text frames that are written will use the specified
> encoding (unless they are specifically overridden on an frame-by-frame
> basis).

That's not how I'd read the code.

void ID3v2::Tag::setTextFrame(const ByteVector &id, const String &value)
{
  if(value.isEmpty()) {
    removeFrames(id);
    return;
  }

  if(!d->frameListMap[id].isEmpty())
    d->frameListMap[id].front()->setText(value); // (*)
  else {
    const String::Type encoding = d->factory->defaultTextEncoding();
    TextIdentificationFrame *f = new TextIdentificationFrame(id, encoding);
    addFrame(f);
    f->setText(value);
  }
}

If we enter the case (*), no encoding is set. Am I mis-reading this?

Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/taglib-devel/attachments/20071017/0b8a148d/attachment.pgp 


More information about the taglib-devel mailing list