+ fix small regression in indexinv (title were without accents)

This commit is contained in:
kelson42 2012-07-12 17:51:23 +00:00
parent c20fd205dd
commit 6ae3c27195
3 changed files with 7 additions and 6 deletions

View File

@ -47,7 +47,8 @@ namespace kiwix {
this->resultCountPerPage = resultEnd - resultStart;
this->resultStart = resultStart;
this->resultEnd = resultEnd;
searchInIndex(removeAccents(search), resultStart, resultEnd, verbose);
string unaccentedSearch = removeAccents(search);
searchInIndex(unaccentedSearch, resultStart, resultEnd, verbose);
this->resultOffset = this->results.begin();
return;

View File

@ -22,13 +22,13 @@
UErrorCode status = U_ZERO_ERROR;
Transliterator *trans = Transliterator::createInstance("Lower; NFD; [:M:] remove; NFC", UTRANS_FORWARD, status);
std::string &removeAccents(std::string &text) {
std::string removeAccents(const std::string &text) {
ucnv_setDefaultName("UTF-8");
UnicodeString ustring = UnicodeString(text.c_str());
trans->transliterate(ustring);
text.clear();
ustring.toUTF8String(text);
return text;
std::string unaccentedText;
ustring.toUTF8String(unaccentedText);
return unaccentedText;
}
void printStringInHexadecimal(UnicodeString s) {

View File

@ -32,7 +32,7 @@
#include <iostream>
#include <string>
std::string &removeAccents(std::string &text);
std::string removeAccents(const std::string &text);
void printStringInHexadecimal(const char *s);
void printStringInHexadecimal(UnicodeString s);