MFC UTF8转Unicode函数

1 //UTF8转Unicode函数
2 wchar_t* CMFCDlg::Utf8ToUnicode(const char* buf)
3 {
4     int len = ::MultiByteToWideChar(CP_UTF8, 0, buf, -1, NULL, 0);
5     wchar_t *tmp = new wchar_t[len*2+1];
6     ::MultiByteToWideChar(CP_UTF8, 0, buf, -1, tmp, len);
7     return tmp;
8 }

 

posted @ 2014-10-21 13:43  kim_berley  阅读(1289)  评论(0编辑  收藏  举报