守望者--AIR技术交流
标题:
vs里面怎么输入汉字
[打印本页]
作者:
yaoyuan0701
时间:
2015-1-6 17:10
标题:
vs里面怎么输入汉字
本帖最后由 yaoyuan0701 于 2015-1-6 17:26 编辑
#ifdef WIN32
inline std::wstring AnsiToUnicode(const char* buf)
{
int len = ::MultiByteToWideChar(CP_ACP, 0, buf, -1, NULL, 0);
if (len == 0) return L"";
std::wstring unicode;
unicode.resize(len);
::MultiByteToWideChar(CP_ACP, 0, buf, -1, &unicode[0], len);
return unicode;
}
inline std::string UnicodeToUtf8(const wchar_t* buf)
{
int len = ::WideCharToMultiByte(CP_UTF8, 0, buf, -1, NULL, 0, NULL, NULL);
if (len == 0) return "";
std::string utf8;
utf8.resize(len);
::WideCharToMultiByte(CP_UTF8, 0, buf, -1, &utf8[0], len, NULL, NULL);
return utf8;
}
inline
std::string AnsioUTF8(const char *strChar)
{
return UnicodeToUtf8(AnsiToUnicode(strChar).c_str());
}
//Windows中做编码转换,
#define UTEXT(str) AnsioUTF8(str)
#else
//Android/iOS中不处理.
#define UTEXT(str) str
#endif
作者:
破晓
时间:
2015-1-6 17:22
现在好了,不需要审核了
欢迎光临 守望者--AIR技术交流 (http://www.airmyth.com/)