LibTags special character
-
I have a this filename:
"♥♫ Feels So Good (sonique Best Remix Extended Version) Music Song Video ❦ love romantic "Usually, to extract the file information I use this code
QString mediafile = playlist->currentMedia().canonicalUrl().toString(); QString tmp = mediafile.left(8) == "file:///" ? mediafile.mid(8) : mediafile; TagLib::FileRef f(QFile::encodeName(tmp).constData());This code works perfectly, only does not work when the file name contains special characters as above. I tried
QTextCodec *codec = QTextCodec::codecForName("UTF-8");with no results.
Any solution? -
Hi,
You'll likely should convert the path to use native separators. Qt uses the *nix notation for paths so e.g. on Windows, you would have to convert the forward slashes to backward.
-
try replacing
QFile::encodeName(tmp)withtmp.toUtf8()also
QString mediafile = playlist->currentMedia().canonicalUrl().toString(); QString tmp = mediafile.left(8) == "file:///" ? mediafile.mid(8) : mediafile;can become
const QString tmp = playlist->currentMedia().canonicalUrl().toLocalFile();