+ 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->resultCountPerPage = resultEnd - resultStart;
this->resultStart = resultStart; this->resultStart = resultStart;
this->resultEnd = resultEnd; this->resultEnd = resultEnd;
searchInIndex(removeAccents(search), resultStart, resultEnd, verbose); string unaccentedSearch = removeAccents(search);
searchInIndex(unaccentedSearch, resultStart, resultEnd, verbose);
this->resultOffset = this->results.begin(); this->resultOffset = this->results.begin();
return; return;

View File

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

View File

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