[reportlab-users] IronPython and UnicodeDecodeError again

Robin Becker robin at reportlab.com
Wed Apr 25 05:31:18 EDT 2012


On 25/04/2012 07:51, Tom T. wrote:

> Hi @ all,

>

> I have just another problem using IronPython 2.7.1 and ReportLab 2.5. I try

> to put some html-formatted text containing umlauts into the

> platypus.Paragraph() function

>

> # example 1

> First I try to put the raw and unicode string into Paragraph(). The result

> is an UnicodeDecodeError.

>

.........

>

> File "C:\Programme\IronPython

> 2.7.1\lib\site-packages\reportlab\platypus\flowables.py", line 89, in

> _drawOn

> File "C:\Programme\IronPython

> 2.7.1\lib\site-packages\reportlab\platypus\paragraph.py", line 868, in wrap

> UnicodeDecodeError: ('unknown', u'\xf6', -1, 0, '')

>

>

> Anyone knows a solution for this problem? In Python 2.7.1 I can handle

> umlauts with Paragraph(). But it's no option to switch to Python. :(

.......
line 868 in wrap is where the wrap method calls breakLines. That is a long
function, is your trace back truncating somewhere?

The fact that the simple unicode method produces two bytes of output probably
means there's an issue with the actual pdf production somewhere in pdfdocs.

Can you try

from reportlab.pdfgen.canvas import Canvas
canv = Canvas('tcanv.pdf')
canv.drawString(72,72,u'This is an umlaut \xf6')
canv.save()

and see if that works; this avoids all of the issues with paragraphs/fonts etc
entirely.
--
Robin Becker


More information about the reportlab-users mailing list