json \u unicode字符串转化 c++

CString GetUStr(const string & str)
{
    std::string showname = str;//\u6211\u7231\u5317\u4eac\u5929\u5b89\u95e8
    int len=strlen(showname.c_str())+1;
    char outch[MAX_PATH];
    WCHAR * wChar=new WCHAR[len];
    wmemset(wChar,0,len);
    MultiByteToWideChar(CP_UTF8, 0, showname.c_str(), len, wChar, len);
    CString strRet = wChar;//转化结果 我爱北京天安门
    delete [] wChar;
    return strRet;
}

 

posted @ 2015-03-17 12:59  瓜蛋  阅读(3789)  评论(1编辑  收藏  举报