ReportLab Encoding Issue When Drawing Translated Text in Django
I encountered an issue when using drawString in ReportLab to draw text in the Czech language after translating the text with Django. I've set the font to Arial, which supports the necessary characters, and noticed the following behavior:
When I draw a string directly like this:
t = "vůči"
self.canvas.drawString(10, 10, t)
The text is rendered correctly.
However, when I try to draw a translated string like this:
from django.utils.translation import gettext as _
t = _("towards")
self.canvas.drawString(10, 10, t)
The text is rendered incorrectly, showing black rectangles instead of the expected characters, indicating that the characters are not being recognized.
Does anyone know why this is happening and how to fix it?