【发布时间】:2019-12-16 12:07:39
【问题描述】:
我有一个 html 页面,我正在使用 QWebEngineView 将其加载到我的 Qt5 应用程序中,如下所示:
QWebEngineView* webEngineView = new QWebEngineView();
webEngineView->setUrl("index.html");
我在我的 html 文件中使用 UTF-8 字符,例如“...”(#x2026;在 html 中),显示为“?”在应用程序中。
html 文件包含
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" 和我尝试使用 webEngineView->settings()->setDefaultTextEncoding("utf-8"); 无济于事。
谁能帮我显示这些字符?
【问题讨论】:
-
您还应该显示包含您的 index.html。
-
感谢您的建议。当我试图为我的 index.html 制作一个可行的小例子时,我意识到问题不在
setUrl()中,而是在我的 JS 文件中的一个 loalisation 函数中,它将编码设置为 ASCII。所以在完全错误的地方寻找解决方案:) -
这是我的个人经历,当我尝试创建 stackoverflow.com/help/minimal-reproducible-example 时,大部分时间这个过程本身解决了我的疑问/问题。
标签: html c++ encoding qt5 qwebengineview