mirror of https://github.com/kiwix/libkiwix.git
+ fix a bug occuring if cutting the snippet in the middle of a multibyte character
This commit is contained in:
parent
41217c22d8
commit
939155a9cb
|
@ -132,7 +132,10 @@ namespace kiwix {
|
||||||
const std::string wordCountString = countWordStringStream.str();
|
const std::string wordCountString = countWordStringStream.str();
|
||||||
|
|
||||||
/* snippet */
|
/* 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 */
|
/* size */
|
||||||
stringstream sizeStringStream;
|
stringstream sizeStringStream;
|
||||||
|
|
|
@ -178,7 +178,7 @@ namespace kiwix {
|
||||||
}
|
}
|
||||||
oData["pages"] = pagesCDT;
|
oData["pages"] = pagesCDT;
|
||||||
|
|
||||||
oData["count"] = this->estimatedResultCount;
|
oData["count"] = this->beautifyInteger(this->estimatedResultCount);
|
||||||
oData["searchPattern"] = this->searchPattern;
|
oData["searchPattern"] = this->searchPattern;
|
||||||
oData["resultStart"] = this->resultStart;
|
oData["resultStart"] = this->resultStart;
|
||||||
oData["resultEnd"] = this->resultEnd;
|
oData["resultEnd"] = this->resultEnd;
|
||||||
|
|
Loading…
Reference in New Issue