首页 > 代码库 > uft8转gb函数

uft8转gb函数

 1 void UTF8ToGB(CString &szOut) 2 { 3     WCHAR *strSrc; 4     TCHAR *szRes; 5     //长度 6     int i = MultiByteToWideChar(CP_UTF8, 0, szOut, -1, NULL, 0); 7     strSrc = http://www.mamicode.com/new WCHAR[i+1]; 8     MultiByteToWideChar(CP_UTF8, 0, szOut, -1, strSrc, i); 9     //长度10     i = WideCharToMultiByte(CP_ACP, 0, strSrc, -1, NULL, 0, NULL, NULL);11     szRes = new TCHAR[i+1];12     WideCharToMultiByte(CP_ACP, 0, strSrc, -1, szRes, i, NULL, NULL);13     szOut = szRes;14     delete []strSrc;15     delete []szRes;16 }

 

uft8转gb函数