BOOL utf8ToAnsi(char* _dir, int _len, const char* _src)
{
int len = MultiByteToWideChar(CP_UTF8,0,_src,-1,0,0);
wchar_t* wchar = new wchar_t[len+1];
if (!wchar)
return FALSE;
MultiByteToWideChar(CP_UTF8,0,_src,-1,wchar,len);
WideCharToMultiByte(CP_ACP,0,wchar,-1,_dir,_len,NULL,NULL);
delete []wchar;
return TRUE;
}
BOOL ansiToUtf8(char* _dir, int _len, const char* _src)
{
int len = MultiByteToWideChar(CP_ACP,0,_src,-1,0,0);
wchar_t* wchar = new wchar_t[len+1];
if (!wchar)
return FALSE;
MultiByteToWideChar(CP_ACP,0,_src,-1,wchar,len);
WideCharToMultiByte(CP_UTF8,0,wchar,-1,_dir,_len,NULL,NULL);
delete []wchar;
return TRUE;
}