有æøå HTML2PDF 字符集中的字符
$content = "ÆØÅ";
$html2pdf = new HTML2PDF('P', 'A4', 'en');
$html2pdf->writeHTML($content, false)
$html2pdf->Output('', 'S'));
给我一个带有“¤”的 PDF 文件,
我检查了 html2pdf.class.php 中的编码,并将其设置为 UTF-8,应该没问题。
我尝试将“en”更改为“da”(丹麦语),结果仍然相同..
请问我该如何解决这个问题?现在花了几个小时寻找..
$content = "ÆØÅ";
$html2pdf = new HTML2PDF('P', 'A4', 'en');
$html2pdf->writeHTML($content, false)
$html2pdf->Output('', 'S'));
Gives me a PDF file with "ÆØÃ"
I checked the encoding in html2pdf.class.php and it is set to UTF-8 which should be fine.
I tried to change 'en' to 'da' (danish), still same result..
How can i fix this please? Spent hours now looking..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您必须做两件事才能在 html2pdf 中看到奇怪的 UTF8 字符:
freeserif
我知道这是个老问题,但我需要一些要点:)
You have to do two things to see strange UTF8 characters in html2pdf:
freeserif
I know it's old question, but I need some points :)
看起来您指定了错误的输出编码。例如,如果尝试将 UTF-8 输出显示为 ISO8859-1,则该输出是典型的输出。
看起来 HTML2PDF 构造函数也有一个以字符编码作为参数的版本:
可能有效...
Looks like you are specifying the wrong output encoding. The output is typical of what you'd get if trying to show UTF-8 output as ISO8859-1, for example.
Looks like the HTML2PDF constructor also has a version that takes a character encoding as the parameter:
could possibly work...
您可以使用这个 PHP 函数,
如果它不起作用,唯一的解决方案是创建一个 str_replace()
对于任何其他特殊字符,您可以在此处查看等效的 HTML 代码: http://www.toutimages.com/codes_caracteres.htm
You can use this PHP function
If it doesn't work the only solution is to make a str_replace()
For any other specials characters you can see the equivalents HTML codes here : http://www.toutimages.com/codes_caracteres.htm