ReportLab, PDF and Latin-1 characters
Klaus Alexander Seistrup
spam at magnetic-ink.dk
Wed Mar 12 16:01:12 EST 2003
Svenne Krap wrote:
><code>
> from reportlab.pdfgen import canvas
> c = canvas.Canvas("C:\\mypdf.pdf")
> c.setFont('Arial',12)
> c.setFont('Helvetica',12)
> c.drawString(10,10,'æøå')
></code>
>
> but then, I get :
>
><error>
> UnicodeError: ASCII encoding error: ordinal not in range(128)
></error>
How about
#v+
>>> utf8 = lambda s: unicode(s, 'iso-8859-1').encode('utf-8')
>>> c.drawString(10, 10, utf8('frække frølår')
#v-
(substitute your input charset for 'iso-8859-1')?
// Klaus
--
><> vandag, môre, altyd saam
More information about the Python-list
mailing list