question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problems with some Unicode characters

See original GitHub issue

Hi, I’m using the latest xhtml2pdf (0.2b1) & reportlab (3.4.0) through django-easy-pdf (0.1.0) on Python 3.6.0 and it’s working great for the most part! One problem I am still experiencing, though, is that some Unicode characters are not rendering properly (šŠčČćĆđĐžŽ):

screen shot 2017-03-29 at 16 38 36

I’m using the default django-easy-pdf base template and I found that I can somewhat repair things if I override it to declare the html encoding:

{% block extra_style %}
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
{% endblock %}

Which results in some characters being rendered correctly like Š and Ž, but not all of them (Č, Ć, Đ are still blacked out).

screen shot 2017-03-29 at 16 38 19

I tried experimenting with different font declarations (sans-serif, serif, external fonts), but I can’t seem to fix this. The characters are never rendered correctly. I don’t know if I’m missing some xhtml2pdf / Reportlab setting here. Do you maybe have an idea of a possible solution?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:9
  • Comments:48 (15 by maintainers)

github_iconTop GitHub Comments

5reactions
adrian-chrostowskicommented, Nov 28, 2018

Any news on fixing the bug? I tried all of the solutions I found on the web and none work, I still get nasty boxes instead of non-latin characters.

2reactions
hadriankubasiewiczcommented, Jul 12, 2020

In my case helps

<style> @font-face { font-family: Roboto; src: "C://Users//user//Desktop//Project//static//fonts//Roboto-Regular.ttf"; } body { font-family: "Roboto", sans-serif; </style>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Unicode Issues - Languagegeek
A newer mapping commonly called ANSI, expanded on ASCII giving us capital versions of the accented letters Á É, and a few extra...
Read more >
Display Problems - Unicode
If you are unable to read some Unicode characters in your browser, it may be because your system is not properly configured. Here...
Read more >
Some Unicode characters suddenly not displaying properly in ...
I'm finding that some of the more obscure Unicode characters have randomly stopped displaying properly on my computer in every single program; ...
Read more >
How to solve unicode encoding issues - Invivoo
Because Unicode can encode all possible characters, it has become a nightmare for artists creating fonts because redrawing each character is an ...
Read more >
14. Unicode issues
Some applications check user inputs as byte strings, but then process them as character strings. This vulnerability can be used to bypass security...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found