[reportlab-users] Using UTF-8 strings with ReportLab.

Jorge Godoy godoy at ieee.org
Tue Dec 20 08:20:09 EST 2005


What is the best way to use UTF-8 strings with ReportLab?  I was replicating
the first example on the user guide and just for fun translated it to pt_BR
(after all, this is the language all my data is in...) and the output isn't

# -*- coding: utf-8 -*-

from reportlab.pdfgen import canvas

def hello(c):
    c.drawString(100,100,'Olá mundo!')

c = canvas.Canvas('ola.pdf')

It works perfectly for ISO-8859-1 strings, though, but then I'd have to
convert everything to it just for the PDF generation and I can't guarantee
that there will be equivalents for everything in my dataset (imagine a
multilingual project, for example).

Thanks in advance,
Jorge Godoy      <godoy at ieee.org>

More information about the reportlab-users mailing list