//文本提取,注意,先转换成Unicode
for (int j = keyPos + 1; j < keyPos2; j++)
{
lineStr = htmlContext[j];
//将整段utf8文字转换为unicode
const char* utf8_text = lineStr.c_str();
int newLen = MultiByteToWideChar(CP_UTF8, 0, (LPSTR)utf8_text, -1, NULL, 0);
wchar_t* unicode_text = new wchar_t[newLen + 1];
memset(unicode_text, 0, (newLen + 1) * sizeof(wchar_t));
MultiByteToWideChar(CP_UTF8, 0, (LPSTR)utf8_text, -1, (LPWSTR)unicode_text, newLen);
delete [] unicode_text;
}
for (int j = keyPos + 1; j < keyPos2; j++)
{
lineStr = htmlContext[j];
//将整段utf8文字转换为unicode
const char* utf8_text = lineStr.c_str();
int newLen = MultiByteToWideChar(CP_UTF8, 0, (LPSTR)utf8_text, -1, NULL, 0);
wchar_t* unicode_text = new wchar_t[newLen + 1];
memset(unicode_text, 0, (newLen + 1) * sizeof(wchar_t));
MultiByteToWideChar(CP_UTF8, 0, (LPSTR)utf8_text, -1, (LPWSTR)unicode_text, newLen);
delete [] unicode_text;
}