how to select the encoding of the mp3 tag to read?

Anton Sergunov setosha at gmail.com
Sun Aug 29 14:37:45 CEST 2010


> I wonder if I could select the encoding of the mp3 tags I am to read.
> Many mp3 here use encoding gb18030 (Chinese).

Encoding stored in ID3v2 tag. So you dont need to set it manual.
But ID3v1 all strings sould be stored in latin encoding. So old
programs stores tag in local encoding. You can't know encoding, but in
most cases old incorrected saved tags in local user encoding.

My Qt solution:

QString toQString(const TagLib::String& str)
{
  if(str.isLatin1())
    return QString::fromLocal8Bit(str.to8Bit().c_str());
  return QString::fromStdWString(str.toWString());
}


More information about the taglib-devel mailing list