[reportlab-users] Small errors in reportlab code

Andy Robinson andy at reportlab.com
Wed Jan 17 11:21:35 EST 2007



>>BTW, wouldn't it be better to ignore useless Unicode and UTF-8 decoding

>>errors by using e.g.

>>

>> s.decode('utf8','ignore')

>>

>>instead of

>>

>> s.decode('utf8')


In general, when I'm building reporting systems, I want to know about
corrupt input as soon as possible. I believe our libraries should be as
strict as possible about this: if you say it's UTF8, it should be UTF8,
and anything else should cause an exception.

Otherwise you end up with ? marks or missing data in printed literature
for somebody else a long time later, and it's very hard to pinpoint
where the error was introduced.

If you have to live with corrupt input, it's only two lines to write
your own "pre-filter" function which will accept bad input.

Potentially we could make this user-configurable in future with a
default of 'strict'.

- Andy





More information about the reportlab-users mailing list