Unicode filenames
Scott Wheeler
wheeler at kde.org
Tue Jun 24 01:11:26 CEST 2008
Colin Kern wrote:
> Hi,
>
> Is there a way to open files with unicode filenames using TagLib? I
> am using Qt, so I have a QString of the filename I want to open.
> Right now, I pass filename.toUtf8().data() to the TagLib::FileRef
> constructor, since it takes a const char*. This works for files that
> just have ASCII filenames, but fails if there are unicode characters.
> QString::unicode() returns a const QChar*, and I'm not sure how to get
> a FileRef from that.
>
Filenames in TagLib are always in the system encoding. For Qt, you'd use:
FileRef ref(QFile::encodeName(filename).data());
-Scott
More information about the taglib-devel
mailing list