自己在用C++做网页访问时出现了 \u9ad8\u8003 的字符串,所以Mark下来,方便以后使用
std::string usc2ToAnsi(std::string str)
{
str = replaceAll(str, "\\u", "0X");
std::string::size_type pos();
while (std::string::npos != (pos = str.find("0X", pos)))
{
std::string tmpString = str.substr(pos, );
WCHAR wcChinese[];
wcChinese[] = (WCHAR)strtol(tmpString.c_str(), NULL, );
wcChinese[] = ;
char Buffer[];
ZeroMemory(Buffer, sizeof(Buffer));
WideCharToMultiByte(CP_ACP, , wcChinese, -, Buffer, sizeof(Buffer), NULL, NULL);
// std::cout << Buffer << std::endl;
str.replace(pos, , Buffer);
pos += strlen(Buffer);
}
return str;
}