+ fix a bug occuring if cutting the snippet in the middle of a multibyte character

This commit is contained in:
kelson42 2011-03-24 07:15:17 +00:00
parent 41217c22d8
commit 939155a9cb
2 changed files with 5 additions and 2 deletions

View File

@ -132,7 +132,10 @@ namespace kiwix {
const std::string wordCountString = countWordStringStream.str();
/* snippet */
const std::string snippet = std::string(this->htmlParser.dump, 0, 300);
std::string snippet = std::string(this->htmlParser.dump, 0, 300);
std::string::size_type last = snippet.find_last_of('.');
if (last != snippet.npos)
snippet = snippet.substr(0, last+1);
/* size */
stringstream sizeStringStream;

View File

@ -178,7 +178,7 @@ namespace kiwix {
}
oData["pages"] = pagesCDT;
oData["count"] = this->estimatedResultCount;
oData["count"] = this->beautifyInteger(this->estimatedResultCount);
oData["searchPattern"] = this->searchPattern;
oData["resultStart"] = this->resultStart;
oData["resultEnd"] = this->resultEnd;