wkhtml2pdf页脚html/header html参数的编码问题



我使用utf-8编码从HTML文件生成PDF。事实上,我的一些标题包含非ascii字符。在主PDF中,一切都很好,编码正确,渲染正常

当设置我的footer.html文件时,每当节名中有非ascii字符时,我就会检索当前未正确显示的节。此节名称作为"section"URL参数传递给footer.html调用;它的编码已经错误了。例如,我在xsl文件中将ToC titel更改为法语"Table des matières"(这是对默认xsl的唯一更改)。

ToC页面在PDF中很好,"è"是正确的。但在我的页脚中,我通过JS检索URI,JS在未编码之前给了我mati%C3%A8res(当我期望它是mati%E8res时),当然它在我的PDF页脚中显示为matières

我在模板、主html文件或页眉/页脚html文件中发现了许多关于编码问题的页面,但没有一个与这些参数有关。如何在PDF中进行修改?

样品运行:

F:test>wkhtmltopdf.exe --encoding "UTF-8" --footer-html footer.html 
--print-media-type toc --xsl-style-sheet default.xsl test.html test.pdf
Loading pages (1/6)
Counting pages (2/6)
Loading TOC (3/6)
Resolving links (4/6)
Loading headers and footers (5/6)
Printing pages (6/6)
Done

问题来自我的JS代码。关于参数,我使用了unencode(),而不是使用正确的函数decodeURIcomponent()

最新更新