Browse Source

fix/pdf_name_ascii (#2341)

* fix/pdf_name_ascii

* adj

* Update src/widgets/pdfviewwindow.cpp

---------

Co-authored-by: Le Tan <[email protected]>
chendapao 2 năm trước cách đây
mục cha
commit
075380749c
1 tập tin đã thay đổi với 2 bổ sung1 xóa
  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);