Socket发送字符串问题
MFC 中 Socket发送字符串的时候,想全部统一成UTF-8编码
请教一下,如何将VS2010中的CString类型转换为UTF-8编码的字串了,还有就是如何在将UTF-8转换为CString类型了
[解决办法]
WideCharToMultiByte
The WideCharToMultiByte function maps a wide-character string to a new character string. The new character string is not necessarily from a multibyte character set.
int WideCharToMultiByte(
UINT CodePage, // code page
DWORD dwFlags, // performance and mapping flags
LPCWSTR lpWideCharStr, // wide-character string
int cchWideChar, // number of chars in string
LPSTR lpMultiByteStr, // buffer for new string
int cbMultiByte, // size of buffer
LPCSTR lpDefaultChar, // default for unmappable chars
LPBOOL lpUsedDefaultChar // set when default char used
);