/************************************************************************/ /* convert Utf8 char to Unicode/LocalCode TCHAR */ /************************************************************************/ TCHAR* ConvertUtf8ToTChar( char* src) { int size = strlen(src)+1; WCHAR* dest = new WCHAR[size]; memset( dest, 0, sizeof(WCHAR)*size ); MultiByteToWideChar(CP_UTF8, 0, src, -1, dest, (int)size); #ifdef UNICODE return dest; #else //convert unicode to local code. int size_local = wcslen(dest) + 1; char* dest2 = new char[size_local]; WideCharToMultiByte(CP_ACP, 0, dest, -1, dest2, size, NULL, NULL); delete[] dest; return dest2; #endif }
Utf8 char to Unicode/LocalCode TCHAR
猜你喜欢
转载自yangbinfx.iteye.com/blog/2003889
今日推荐
周排行