How to convert MFC::CString to UTF8 wchar_t*
Posted on 2016-09-27
I wonder if MFC::CString is ansi or utf-8 by default. My thought would be to consider it as ansi so the question is how to convert the following sequence:
1. CString str = _T("Hello World");
2. char* pszAnsi = str.GetBuffer();
3. wchar_t* pwUnicode = CString(pszAnsi).AllocSysString();
4. wchar_t* pwUTF-8 = ConvertUnicodeToUTF-8(pwUnicode);
Is it the right sequency ? I know I can directly skip from 1 to 3 but my big wish is to have a method from char* ansi to wchar_t* utf-8 directly.
What can you tell me about that conversion query ?
Thank you very much in advance.