CString MyUTF8toANSI(CString instr) //utf-8-->ansi
{
WCHAR wcharstr[MAX_STRSIZE];
memset(wcharstr,0,MAX_STRSIZE);
MultiByteToWideChar(CP_UTF8,0,(LPCSTR)instr,-1,wcharstr,MAX_STRSIZE);
char charstr[MAX_STRSIZE];
memset(charstr,0,MAX_STRSIZE);
WideCharToMultiByte(CP_ACP,0,wcharstr,-1,charstr,MAX_STRSIZE,NULL,NULL);
CString charstrtemp(charstr);
return charstrtemp;
}
CString MyANSItoUTF8(CString instr) //ansi-->utf-8
{
WCHAR wcharstr[MAX_STRSIZE];
memset(wcharstr,0,MAX_STRSIZE);
MultiByteToWideChar(CP_ACP,0,(LPCSTR)instr,-1,wcharstr,MAX_STRSIZE);
char charstr[MAX_STRSIZE];
memset(charstr,0,MAX_STRSIZE);
WideCharToMultiByte(CP_UTF8,0,wcharstr,-1,charstr,MAX_STRSIZE,NULL,NULL);
CString charstrtemp(charstr);
return charstrtemp;
}