解决方案 »

  1.   

    第一个工程是_UNICODE,代表是宽字符集
    第二个工程是_MBCS,代表是多字节字符集
    你把第一个工程也改成_MBCS试试
      

  2.   

    你搜下宽字符和多字节字符的转换函数
    好像是widechartoanti什么来着
      

  3.   

    int nLen = strName.GetLength();
    WCHAR szName[MAX_PATH]; 
    //memset(szName, 0, MAX_PATH);
    int n = MultiByteToWideChar(CP_UTF8, 0, strName.GetBuffer(nLen), nLen, szName, MAX_PATH);
    *(szName + n) = 0; 
    TRACE("%s\r\n", szName);
    是这个函数,但是这个函数在第一个工程中会报错。
      

  4.   

    MultiByteToWideChar(CP_ACP, 0, strName.GetBuffer(nLen), nLen, szName, MAX_PATH);
      

  5.   

    将取得的strName用WideCharToMultiByte转换为ANSI字符看一下。
      

  6.   

    楼上的各位,报下面的错误:
    error C2664: 'MultiByteToWideChar' : cannot convert parameter 3 from 'unsigned short *' to 'const char *'
            Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
      

  7.   

    说明你当前的工程为Unicode编码的
      

  8.   

    你这样写:
    int len = WideCharToMultiByte(CP_ACP,WC_COMPOSITECHECK,strName,-1,NULL,0,NULL,NULL);
    char *pszText = new char[len+1];
    memset(pasText,len,sizeof(pszText));
    WideCharToMultiByte(CP_ACP,WC_COMPOSITECHECK,strName,-1,pszText,len,NULL,NULL);Debug下跟一下,看执行完后,pszText的值。
      

  9.   

    您好,我跟踪了,pszText还是乱码,和原来一样
      

  10.   

    把服务器的字符集修改unicode,这样客户端和服务器的字符集一致,就不会有乱码了,结贴了