How to set unicode strings for USLT frame?

qinda1979 at sina.com qinda1979 at sina.com
Tue Jul 22 04:50:15 CEST 2008


 I want to set lyrics of USLT frame to Chinese, and Unicode strings need to be used.The following is my code:
void CID3tag::SetLyrics(const char* pszLrc)
{
      int dwLength = MultiByteToWideChar(CP_ACP,0,pszLrc, strlen(pszLrc),NULL,0);
      wchar_t *dwBuffer = new WCHAR[dwLength];
      int dwBufLen = MultiByteToWideChar(CP_ACP,0,pszLrc,strlen(pszLrc),dwBuffer,dwLength);

     TagLib::ID3v2::UnsynchronizedLyricsFrame *frame = new TagLib::ID3v2::UnsynchronizedLyricsFrame;
     frame->setLanguage(ByteVector("zho")); 
     frame->setDescription(frame->description());
     frame->setTextEncoding(String::UTF16);
     frame->setText(String(dwBuffer));
     tag->addFrame(frame);
     file->save();
     delete dwBuffer;
}
but it doesn't work. Nothing is changed.  I tried using it to set english text,
frame->setLanguage(frame->language()); 
 frame->setDescription(frame->description());
 frame->setTextEncoding(frame->textEncoding());
 frame->setTextEncoding("abcdefg");
It is fine. How to set unicode string of chinese for USLT tag?


-------------------------------------------------------------------
注册新浪2G免费邮箱(http://mail.sina.com.cn/)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/taglib-devel/attachments/20080722/79efe478/attachment.html 


More information about the taglib-devel mailing list