Unicode FileRef Instantiation

Scott Wheeler wheeler at kde.org
Mon Jan 25 06:31:48 CET 2010


On Jan 25, 2010, at 3:08 AM, Zach Rattner wrote:

> 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: http://doc.trolltech.com/4.6/qstring.html#toStdWString

That's wrong, and will break with any system API.  The right call is  
here:

http://doc.trolltech.com/4.6/qfile.html#encodeName

i.e.

TagLib::FileRef File(QFile::encodeName(p_FilePath).data());

-Scott


More information about the taglib-devel mailing list