big5 <-> utf8 using vc++
big5->unicode
len=MultiByteToWideChar (CP_ACP, 0, sendbuf, -1, NULL,0) ;unicode->UTF-8
sendwbuf=new wchar_t[iLen+1];
MultiByteToWideChar(CP_ACP, 0, sendbuf, -1, sendwbuf, iLen);
len=WideCharToMultiByte (CP_UTF8, 0, sendwbuf, -1, NULL,0 ,NULL, NULL);參考資料: 每個軟體開發者都絕對一定要會的Unicode及字元集必備知識(沒有藉口!)
sendbuf_utf8=new char[iLen+1];
WideCharToMultiByte (CP_UTF8, 0, sendwbuf, -1, sendbuf_utf8,iLen, NULL, NULL);
留言
張貼留言