我用VC写了个程序,读取网页上的内容,但是网页字符集可能不是“多字符集”,要怎样转换呢?麻烦说的详细些,谢谢

解决方案 »

  1.   

    CString strText = _T("XXXXXXXXXX"); 
    LPWSTR lpwText = strText.GetBuffer(strText.GetLength()); 
    strText.ReleaseBuffer(); char buff[MAX_LENGTH]; 
    int iSizeS = wcslen(lpwText); 
    WideCharToMultiByte(CP_ACP, 0, lpwText, iSizeS, buff, sizeof(buff), NULL, NULL); // 将宽字节(UNICODE)转化成多字节(ANSI)的 
    buff[iSizeS] = '\0'; 你可以使用 
    MultiByteToWideChar(CP_ACP, 0, buff1, sizeof(buff1), wbuff, sizeof(wbuff)); 
    将多字节转化成宽字节
      

  2.   

    MultiByteToWideChar
    WideCharToMultiByte