[reportlab-users] Less than, Greater than, Ampersand, Oh My!

Tom Wiebe tom.wiebe at gmail.com
Tue Jun 13 01:09:10 EDT 2006


Hi There again,

Just wondering what the best way to encode <,>,& and the like. In my
initial flailing about developing on my mac, I simply replaced them
with their html-encoded entities and it worked like a charm. i.e.
&lt;, &gt;, &amp; (I know it's not in the manual, I tried it and it
worked first go so I left it there).

Now, when I'm trying to get things to work on the Windows side of
things, my earlier success with html encoding seems to not work any
longer, giving me the following error:

ABag instance has no attribute 'strike'

Looks like it's going south rather deep in Reportlab somewhere, I
haven't been able to figure out exactly what.

I've tried replacing with the unicode equivalent of <, >, and &, I've
also tried the <unichar /> tag, neither seem to work right or, I'm
just not doing them right. Not quite sure.

Using:
ActivePython 2.4.3 (latest)
ReportLab 2.0

The text I'm trying to fix is in either a unicode cp1252 string (from
MSSQL 2005) or utf-8 (from a static text string).

Aside from these 3 characters, which I'm assuming are reserved for
some xml reasons, I'm having no encoding problems (i.e. characters
like (c), =99 and curley quotes are all coming through A-OK).

boom =3D Paragraph(u'''This & This will go >< Boom!''',style)

Would be an example of a paragraph that, uh, goes boom for me, when
it's inserted into my flowables.

TIA,

Tom Wiebe


More information about the reportlab-users mailing list