UTF-8转GB2312 c++源代码
时间:2010-07-20 来源:平淡的生活
| void CCheckMailDlg::UTF8ToGB(CString szinput,CString &szOut) |
| { |
| WCHAR *strSrc; |
| TCHAR *szRes; |
| int i = MultiByteToWideChar(CP_UTF8, 0, szinput, -1, NULL, 0); |
| strSrc = new WCHAR[i+1]; |
| MultiByteToWideChar(CP_UTF8, 0, szinput, -1, strSrc, i); |
| i = WideCharToMultiByte(CP_ACP, 0, strSrc, -1, NULL, 0, NULL, NULL); |
| szRes = new TCHAR[i+1]; |
| WideCharToMultiByte(CP_ACP, 0, strSrc, -1, szRes, i, NULL, NULL); |
| szOut = szRes; |
| delete []strSrc; |
| delete []szRes; |
| } |
相关阅读 更多 +










