This commit is contained in:
Tim Blume 2020-09-03 10:54:25 +02:00
parent c02fc1fd36
commit 720269fb03
2 changed files with 13 additions and 5 deletions

View file

@ -99,16 +99,18 @@ QVariant HistoryModel::data(const QModelIndex &index, int role) const
} }
case 8:{ case 8:{
std::string tmp = item.request_content; std::string tmp = item.request_content;
replaceAll(tmp, "\\n", "\n"); //replaceAll(tmp, "\\n", "\n");
return QString::fromStdString(tmp); return QString::fromUtf8(tmp.c_str());
} }
case 9:{ case 9:{
return QString::fromStdString(getResponseHeader(item)); return QString::fromStdString(getResponseHeader(item));
} }
case 10:{ case 10:{
std::string tmp = item.response_content; std::string tmp = item.response_content;
replaceAll(tmp, "\\n", "\n"); //replaceAll(tmp, "\\", "\");
return QString::fromStdString(tmp); //std::cout << tmp << std::endl;
return QString::fromUtf8(tmp.c_str());
//return QString::fromStdString(tmp);
} }
} }
throw std::out_of_range("history model col"); throw std::out_of_range("history model col");

View file

@ -15,7 +15,13 @@ def convert_to_strings(obj):
elif isinstance(obj, list) or isinstance(obj, tuple): elif isinstance(obj, list) or isinstance(obj, tuple):
return [convert_to_strings(element) for element in obj] return [convert_to_strings(element) for element in obj]
elif isinstance(obj, bytes): elif isinstance(obj, bytes):
return str(obj)[2:-1] data = ""
try:
data = obj.decode('unicode-escape').encode('latin1').decode('utf-8')
except:
data = str(obj)[2:-1]
return data
return obj return obj
class NetworkThread(threading.Thread): class NetworkThread(threading.Thread):