GUI restable: make sure the URL column is UTF-8, else url-encode it for display
This commit is contained in:
parent
b0bfed7b63
commit
d07112807c
@ -373,8 +373,19 @@ QVariant RecollModel::data(const QModelIndex& index, int role) const
|
|||||||
|
|
||||||
string colname = m_fields[index.column()];
|
string colname = m_fields[index.column()];
|
||||||
|
|
||||||
|
string data = m_getters[index.column()](colname, doc);
|
||||||
|
|
||||||
|
// Special case url, because it may not be utf-8. URL-encode in this case.
|
||||||
|
if (!colname.compare("url")) {
|
||||||
|
int ecnt;
|
||||||
|
string data1;
|
||||||
|
if (!transcode(data, data1, "UTF-8", "UTF-8", &ecnt) || ecnt > 0) {
|
||||||
|
data = url_encode(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
list<string> lr;
|
list<string> lr;
|
||||||
g_hiliter.plaintorich(m_getters[index.column()](colname, doc), lr, m_hdata);
|
g_hiliter.plaintorich(data, lr, m_hdata);
|
||||||
return QString::fromUtf8(lr.front().c_str());
|
return QString::fromUtf8(lr.front().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user