big5 <-> utf8 using vc++
知其然而不知其所以然, 太糟糕了!
big5->unicode
len=MultiByteToWideChar (CP_ACP, 0, sendbuf, -1, NULL,0) ; sendwbuf=new wchar_t[iLen+1]; MultiByteToWideChar(CP_ACP, 0, sendbuf, -1, sendwbuf, iLen);
unicode->UTF-8
len=WideCharToMultiByte (CP_UTF8, 0, sendwbuf, -1, NULL,0 ,NULL, NULL); sendbuf_utf8=new char[iLen+1]; WideCharToMultiByte (CP_UTF8, 0, sendwbuf, -1, sendbuf_utf8,iLen, NULL, NULL);
This post is licensed under CC BY 4.0 by the author.