amici-infotech/craft-super-pdf

Special characters are being replaced in PDF

Closed this issue · 4 comments

Thanks for the plugin, very useful!

I don't know how I can fix the following though: any special/accented character, like é and ë, is being replaced by the 'standard' character with a question mark in the pdf-file, so e? in both mentioned cases.

Any idea how I can resolve this?

hey @MetaDevelopment pretty sure thats not happen inside plugin. Can you test just a blank page with this code? attaching how it looks in my end. (my wild guess is, fonts you are using are not allowing you to write such characters)

{% set html %}
<!doctype html>
<html>
    <head>
        <meta charset="UTF-8">
    </head>
<body>
    <div>
        <p>
            test é and ë
            Ä,Ö,Ü,ß
        </p>
    </div>
</body>
</html>
{% endset %}
{% set settings = {
    filename: "My_PDF",
    type: 'object'
} %}
{% set object = craft.superpdf.html(html, settings) %}

<iframe src="{{ object.getUrl() }}" frameborder="0" width="1000" height="600"></iframe>

Screenshot at May 29 13-21-02

Hi @amici-infotech ,

Thanks for the super quick feedback!

I've added that page and the result looks the same as in your example: the characters show as expected. It's the same font though as in my template (no custom font, since I didn't get that to work in the PDF).

Strange. Can you remove most part from your pdf template and add them one by to find out where its breaking it? Start from removing any tags.

OK, found it.

  • started stripping down the template until only one rich text field tag remained: the issue persisted
  • since the template is now exactly the same as your example, which does work, the problem should be in the rich text field
  • added your paragraph to the rich text and there those characters do show correctly, but the ones in the original text still do not
  • after removing the characters from within the original text and adding them again by typing them, they do show correctly

So it was not a plugin issue, nor a server settings issue, but rather an issue with the text. I guess that was pasted from somewhere and the characters didn't come over properly.

Anyway, thank you very much for the quick and to the point support!