improve unicode handling when setting Start page

This commit is contained in:
wmayer
2018-10-05 15:36:34 +02:00
parent d9e4c727db
commit f5befc75ce
4 changed files with 37 additions and 2 deletions

View File

@@ -119,10 +119,14 @@ Py::Object BrowserViewPy::setHtml(const Py::Tuple& args)
{
char* HtmlCode;
char* BaseUrl;
if (! PyArg_ParseTuple(args.ptr(), "ss",&HtmlCode,&BaseUrl))
if (!PyArg_ParseTuple(args.ptr(), "et|s","utf-8",&HtmlCode,&BaseUrl))
throw Py::Exception();
std::string EncodedHtml = std::string(HtmlCode);
PyMem_Free(HtmlCode);
if (myWebView)
myWebView->setHtml(QString::fromUtf8(HtmlCode),QUrl(QString::fromLatin1(BaseUrl)));
myWebView->setHtml(QString::fromUtf8(EncodedHtml.c_str()), QUrl(QString::fromLatin1(BaseUrl)));
return Py::None();
}
}