/*
多字节转UTF-8函数
*/
CString CNurseDialog::multiToUtf8(CString& str_multi)
{
CString str_utf8;
int len = MultiByteToWideChar(CP_ACP, 0, (LPCTSTR)str_multi, -1, NULL, 0);
wchar_t * wszUtf8 = new wchar_t[len + 1];
memset(wszUtf8, 0, len * 2 + 2);
MultiByteToWideChar(CP_ACP, 0, (LPCTSTR)str_multi, -1, wszUtf8, len);
len = WideCharToMultiByte(CP_UTF8, 0, wszUtf8, -1, NULL, 0, NULL, NULL);
char *szUtf8 = new char[len + 1];
memset(szUtf8, 0, len + 1);
WideCharToMultiByte(CP_UTF8, 0, wszUtf8, -1, szUtf8, len, NULL, NULL);
str_utf8 = szUtf8;
delete[] szUtf8;
delete[] wszUtf8;
return str_utf8;
}
/*
UTF-8转多字节函数
*/
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余1页未读,立即下载