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

berlinud berlinudberlinud at
Mon Aug 30 04:43:35 CEST 2010

With trial and error,I found an answer like this:


this->m_strTitle = QString::fromLocal8Bit(tag->title().toCString(false));

I found it that I don't need to judge whether it is Latin1,Maybe GB18030 is
compatible to Latin1 :)

Thx anyway Anton.

I am considering the reason why this works.

On Sun, Aug 29, 2010 at 8:37 PM, Anton Sergunov <setosha at> wrote:

> > 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());
> }
> _______________________________________________
> taglib-devel mailing list
> taglib-devel at
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the taglib-devel mailing list