wkhtmltopdf 没有正确转换引号和空格

Key*_*r K 3 php wkhtmltopdf phpwkhtmltopdf

我正在使用这个wkhtmltopdf 0.12.3 (with patched qt)版本的 wkhtmltopdf。使用蒙特塞拉特字体系列。

HTML是这样的,

<strong>
    This Agreement for home staging and rental of furniture and accessories 
</strong>
(“Agreement”) is entered this 
Run Code Online (Sandbox Code Playgroud)

其中输出为,

同意家居装饰和家具及配件的租赁(???同意??)

和,

<u>Services</u>&nbsp; 
Subject to the terms and conditions of this </span>
Run Code Online (Sandbox Code Playgroud)

其中输出为,

 服务 受本条款和条件的约束

为什么这些Â介于两者之间?

我试图替换这样的引号和空格,

$formData = str_replace('&nbsp;', ' ', $formData);
$formData = str_replace('&quot;', '"', $formData);
$formData = str_replace('“', '"', $formData);
$formData = str_replace('”', '"', $formData);
Run Code Online (Sandbox Code Playgroud)

但没有帮助。难道我做错了什么?已搜索,但找不到解决方案。

小智 5

在 head 标签之后写这个:

<meta charset="UTF-8" />
Run Code Online (Sandbox Code Playgroud)

  • 添加元标记后为我工作。使用`wkhtmltoimage 0.12.5(带有补丁的qt)`测试 (2认同)