having trouble to encode muti-byte char to mp3's title using taglib

Dongxu Ma dongxu.ma at gmail.com
Tue Apr 3 12:22:33 CEST 2007


Hi allen,

Internally taglib stores tag in UTF16 encoding. While old taglib version
will decode
as Latin1 in whatever case by mistake.
A work around is to specify UTF8 as default internal encoding, by something
like this:
<code>
TagLib::ID3v2::FrameFactory *f =
Audio::TagLib::ID3v2::FrameFactory::instance();
f->setDefaultTextEncoding(TagLib::String::UTF8);
TagLib::MPEG::File *i = new TagLib::MPEG::File(path);
i->setID3v2FrameFactory(f);
</code>

A similar bugzilla at http://rt.cpan.org/Public/Bug/Display.html?id=25401

>
>    1. having trouble to encode muti-byte char (chinese big5) to
>       mp3's title       using taglib (allen lau)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sat, 31 Mar 2007 09:59:49 -0700 (PDT)
> From: allen lau <sirpelidor at yahoo.com>
> Subject: having trouble to encode muti-byte char (chinese big5) to
>         mp3's title     using taglib
> To: taglib-devel at kde.org
> Message-ID: <917875.36723.qm at web58707.mail.re1.yahoo.com>
> Content-Type: text/plain; charset=iso-8859-1
>
> Hi,
>
> I was reading the thread on February 2007 titled: "bug
> encoding multibyte?   Ray".  But I didn't find my
> answer, hope I can get my anaswer here :)
>
> I was trying to write a chinese (big5) song title into
> a mp3 file using TagLib.  Upon completed operation,
> the song title shows as ????.mp3 in both window and
> ITunes.  I think I must missing a small step... would
> anyone please help me take a look at what I did wrong?
>
> Thank you
>
> [code]
> string path = "C:/test.mp3";
>
> try
>             {
>                 TagLib.File file =
> TagLib.File.Create(path);
>                 file.Tag.Title = "&#40654;&#26126;";
> //big5 chinese char
>                 file.Save();
>             }
>             catch (Exception e)
>             {
>                 Console.Write(e.ToString());
>                 return;
>             }
> [/code]
>
>
>


-- 
cheers,
-dongxu
__END__
http://search.cpan.org/~dongxu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/taglib-devel/attachments/20070403/0050368b/attachment.html 


More information about the taglib-devel mailing list