Tagging with wchar_t with Unicode characters.
Jeremy Gregorio
jeremy.firefox.addon at gmail.com
Tue Feb 8 05:58:07 CET 2011
Hi again,
I'm almost there, but I'm still missing something. I wrote a function for my
Firefox plugin:
NS_IMETHODIMP MyComponent::Tag(const PRUnichar *path, const PRUnichar
*title, const PRUnichar *artist, const PRUnichar *album, const PRUnichar
*comment, const PRUnichar *genre, const PRUnichar *year, const PRUnichar
*track)
{// Function takes 8 parameters.
TagLib::FileRef f(path);
if(!f.isNull() && f.tag()) { //check if the file isn't null & the f.tag
objects is ready. If it is we're ok to proceed.
TagLib::Tag *t = f.tag();
TagLib::String tlTitle = title;
t->setTitle(tlTitle);
f.save();
return NS_OK;
}else{
return NS_ERROR_OUT_OF_MEMORY; //if the f object or the f.tag object
are bad return an NS_ERROR_OUT_OF_MEMORY error.
}//END IF
}//END FUNCTION TAG
The PRUnichars pointers end up being pointers to wchar_t because I'm
building on Windows.
It works if I have a simple title ascii, like "My Title", but if I have
Unicode characters like so:
"JURIAN BEAT CRISIS / サクラ舞う"
It fails. I don't get any errors, it just doesn't write the title.
Do I need to add some parameters to my function calls to get it to handle
the characters?
Thanks again! :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/taglib-devel/attachments/20110207/04a0bb11/attachment.htm
More information about the taglib-devel
mailing list