Creating FileRef object from QString

Michael Pyne mpyne at purinchu.net
Sun Dec 6 08:30:27 CET 2009


On Saturday 05 December 2009 23:56:58 Plasty Grove wrote:
> Thanks so much Michael. That's exactly what was needed, straight ASCII
> conversion.
> 
> This is what works:
> 
> QString qstr = "/home/mydir/music/song.mp3";
> TagLib::FileRef tagFile(qstr.toAscii());
> 
> Apologies, I didn't take note of the toAscii() function.

Please keep in mind that this is still broken in like 92% of the world or so. 
You will in general need to use /some/ encoding, you just need to make sure 
TagLib is using the same one.

I'd recommend UTF8 as it's supported by both TagLib and Qt.

Indeed, I finally took a look at the TagLib String API reference 
(http://developer.kde.org/~wheeler/taglib/api/classTagLib_1_1String.html) and 
noted that the function you want is already defined:

QStringToTString(s) (in the Related Functions section).

So don't reinvent the wheel, just use QStringToTString

Regards,
 - Michael Pyne
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/taglib-devel/attachments/20091206/2025d408/attachment.sig 


More information about the taglib-devel mailing list