Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3042

[RESOLVED] wstring Conversion

$
0
0
Hi,

I was read a korean string and display the text.


Code:


std::wstring s2ws(const std::string& str)
{
    int size_needed = MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), NULL, 0);
    std::wstring wstrTo( size_needed, 0 );
    MultiByteToWideChar(CP_UTF8, 0, &str[0], (int)str.size(), &wstrTo[0], size_needed);
       
        //LPCWSTR result = wstrTo.c_str();
        //::AfxMessageBox((CString)result);

    return wstrTo;
}


void CApplicationDlg::Calling()
{       
        //s2ws(m_pLanguage->GetString(IDS_EXAMPLE).c_str());  //Read string from dll

        s2ws("인도 남부의 맨체스터로 알려진 코임 바토르는 직물로 유명합니다.");
}

It display like wstrTo L"?? ??? ????? ??? ?? ???? ??? ?????." using watch window.

reading english, dutch, german & french characters working good.

Viewing all articles
Browse latest Browse all 3042

Trending Articles