CString转UTF8,UTF8转CString
所需积分/C币: 49 浏览量·570 TXT 1KB 2019-07-12 09:06:57 上传
CString转UTF8,UTF8转CString。
资源推荐
资源详情
资源评论
/*
多字节转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转多字节函数
*/














资源评论


上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
已下载
下载帮助

看过该资源的人还看了
没有合适的资源?快使用搜索试试~ 我知道了~
安全验证
文档复制为VIP权益,开通VIP直接复制
