浏览代码

fix/pdf_name_ascii (#2341)

* fix/pdf_name_ascii

* adj

* Update src/widgets/pdfviewwindow.cpp

---------

Co-authored-by: Le Tan <[email protected]>
chendapao 2 年之前
父节点
当前提交
075380749c
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      src/widgets/pdfviewwindow.cpp

+ 2 - 1
src/widgets/pdfviewwindow.cpp

@@ -119,7 +119,8 @@ void PdfViewWindow::syncEditorFromBuffer()
     auto buffer = getBuffer();
     if (buffer) {
         const auto url = PathUtils::pathToUrl(buffer->getContentPath());
-        const auto urlStr = url.toString(QUrl::EncodeSpaces);
+        // Solution to ASCII problems, like these file names with these symbols # + &.
+        const auto urlStr = QUrl::toPercentEncoding(url.toString(QUrl::FullyDecoded));
         auto templateUrl = PathUtils::pathToUrl(HtmlTemplateHelper::getPdfViewerTemplatePath());
         templateUrl.setQuery("file=" + urlStr);
         m_viewer->setHtml(HtmlTemplateHelper::getPdfViewerTemplate(), templateUrl);