Unicode FileRef Instantiation
zach.rattner at gmail.com
Mon Jan 25 03:08:00 CET 2010
I'm using TagLib on one of my projects (using Qt 4.5), and I'm having some
trouble with foreign character support. I have a couple mp3 files with
non-ASCII characters in the file path (mainly just accented vowels). Based
on the TagLib::FileRef API, it appears as though the only way to create a
file reference from a path is with a char *. Is there any way I can use a
Unicode string to pass in the filename?
The issue I'm encountering is best illustrated as follows:
TagLib::FileRef File(p_FilePath.toStdString().c_str()); // Compiles and
works, but breaks down if filename has non-ASCII characters
TagLib::FileRef File(p_FilePath.toStdWString()); // Doesn't compile
The Qt documentation of toStdWString can be found at the following address:
Here's an example that works, going in the opposite direction (loading
Unicode data from an existing reference):
QString Title = QString::fromStdWString(File.tag()->title().toWString());
I would appreciate any clarification you are able to give. It's entirely
possible I'm just not using the class properly. Apart from this issue, I'm
thoroughly impressed with TagLib. Good work!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the taglib-devel