Giriş
Multi Byte Character Set'ten UTF-16'ya çevirir. Multi Byte Character Set'e çevirir. Açıklaması şöyle.
Örnek
Şöyle yaparız.
Multi Byte Character Set'ten UTF-16'ya çevirir. Multi Byte Character Set'e çevirir. Açıklaması şöyle.
Multibyte character sets (MBCSs) are an older approach to the need to support character sets, like Japanese and Chinese, that cannot be represented in a single byte. If you are doing new development, you should use Unicode for all text strings except perhaps system strings that are not seen by end users. MBCS is a legacy technology and is not recommended for new development.
Örnek
Şöyle yaparız.
#include <windows.h>
#include <string>
std::wstring MBCS_to_UTF16(LPCSTR sz)
{
// MBCS to UNICODE
std::wstring strResult;
size_t nCharsDone = 0;
const size_t nMaxsWords = 6 * strlen(sz);
strResult.resize(nMaxsWords + 1);
if (S_OK == ::mbstowcs_s(&nCharsDone, &strResult[0], nMaxsWords + 1, sz, nMaxsWords))
strResult.resize(nCharsDone);
else
strResult.clear();
return strResult;
}
Hiç yorum yok:
Yorum Gönder