int CUtility::AnsiToUTF_8(const char* pSrc, char* pDest, int nOut)
{
USES_CONVERSION;
wchar_t *wc = A2W( pSrc ); // ANSI to UCS-2
return ::WideCharToMultiByte( CP_UTF8, 0, wc, -1, pDest, nOut, 0, 0 ); // UCS-2 to UTF-8
}
char* CUtility::AnsiToUTF_8(const char* pSrc, int nOut)
{
char *out;
out=(char*)malloc(nOut);
USES_CONVERSION;
wchar_t *wc = A2W( pSrc ); // ANSI to UCS-2
::WideCharToMultiByte( CP_UTF8, 0, wc, -1, out, nOut, 0, 0 ); // UCS-2 to UTF-8
return out;
}
{
USES_CONVERSION;
wchar_t *wc = A2W( pSrc ); // ANSI to UCS-2
return ::WideCharToMultiByte( CP_UTF8, 0, wc, -1, pDest, nOut, 0, 0 ); // UCS-2 to UTF-8
}
char* CUtility::AnsiToUTF_8(const char* pSrc, int nOut)
{
char *out;
out=(char*)malloc(nOut);
USES_CONVERSION;
wchar_t *wc = A2W( pSrc ); // ANSI to UCS-2
::WideCharToMultiByte( CP_UTF8, 0, wc, -1, out, nOut, 0, 0 ); // UCS-2 to UTF-8
return out;
}