- 积分
- 1284
- 注册时间
- 2014-12-29
- 最后登录
- 2016-11-14
- 在线时间
- 17 小时
- 威望
- 11
- 贡献
- 0
- 金币
- 359
- 钢镚
- 20
- 交易凭证
- 0
- 分享
- 0
- 精华
- 0
- 帖子
- 19
- 主题
- 18
TA的每日心情 | 慵懒 2015-4-16 10:25 |
---|
签到天数: 8 天 [LV.3]偶尔看看II
版主
- 威望
- 11
- 贡献
- 0
- 金币
- 359
- 钢镚
- 20
|
本帖最后由 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 |
评分
-
查看全部评分
|