Problem using TagLib::FileRef under Windows with exotic filename
Joel Lopes Da Silva
joel at lopes-da-silva.com
Thu Nov 27 17:37:01 CET 2008
Hello,
Sorry about this silly question but I tried many many things to get a
small C++ function to open an MP3 file with TagLib under Windows, and
yet, I can't get it to work with exotic filenames (such as Japanese
filenames).
Here is basically what I did:
string utf8 = "C:\\path\\to\\audioFileWithJapaneseFilename.mp3";
int charcount = MultiByteToWideChar(CP_UTF8, 0, utf8.c_str(), -1,
NULL, 0);
wchar_t* buf = new wchar_t[charcount];
MultiByteToWideChar(CP_UTF8, 0, utf8.c_str(), -1, buf, charcount);
TagLib::FileRef f(buf);
I generated a Visual Studio 2008 project with Cmake and the sources of
TagLib, and I modified the main function of tagreader.cpp to put this
code within the main function (and I removed the "for" loop). And I am
sure my tagreader.cpp file is encoded in UTF-8.
Under Mac OS X and Linux, my problem is already solved thanks to
QFile::encodeName, but I really can't get this small piece of code to
work under Windows. And I accept to use almost any solution: using
some special function of Qt, or using MultiByteToWideChar, or anything
else.
Thank you very much in advance.
--
Joel Lopes Da Silva
More information about the taglib-devel
mailing list