std::wstring UnicodeFileName(LPCSTR lpInFile)
{
std::string strInFile = lpInFile;
UINT CodePage = CP_ACP;
//check if lpInFile is UT8, if is, remove the BOM and set the codepage
if (strInFile.compare(0, 3, "\xEF\xBB\xBF") == 0)
{
strInFile.erase(0, 3);
CodePage = CP_UTF8;
}
//get the length of the Unicode
int nLength = MultiByteToWideChar(CodePage, 0, strInFile.c_str(), -1, NULL, NULL);
std::wstring strOutFile(nLength, 0);
//convert UTF8/ANSI to Unicode
MultiByteToWideChar(CodePage, 0, strInFile.c_str(), -1, &strOutFile[0], nLength);
return strOutFile;
}