void ansi2utf8(char *pInput, char **pOut)
{
wchar_t pwstr[MAX_PATH];
size_t nLen = 0;
int len = 0;
nLen = strlen(pInput);
len = MultiByteToWideChar(0, 0 , (const char *)pInput, (int)nLen, NULL, 0);
if( len >= MAX_PATH )
{
len = MAX_PATH - 1;
}
MultiByteToWideChar(0, 0, (const char *)pInput, (int)nLen, pwstr, len);
pwstr[len]=0;
len = WideCharToMultiByte(CP_UTF8, NULL, pwstr, wcslen(pwstr), NULL, 0, NULL, NULL);
*pOut = (char *)oef_crt_malloc(len + 1);
WideCharToMultiByte(CP_UTF8, NULL, pwstr, wcslen(pwstr), *pOut, len, NULL, NULL);
(*pOut)[len] = '\0';
}
ANSI 转 Unicode
最新推荐文章于 2024-07-27 14:10:59 发布