[reportlab-users] UTF8 Encoded Strings

Rich Shepard rshepard at appl-ecosys.com
Wed Oct 31 09:42:38 EDT 2007


How do I configure ReportLab to handle UTF8 strings in textobjects?

My data look like this tuple: (u'Jobs', u'Infrastructure'), and when I try
to print them using this for loop

for pairs in pairData:
textobject.textLine(pairs)
pg.drawText(textobject)

this error is returned:

Traceback (most recent call last):
File "learnRL.py", line 80, in ?
econRun()
File "learnRL.py", line 70, in econRun
textobject.textLine(pairs)
File "/usr/lib/python2.4/site-packages/reportlab/pdfgen/textobject.py",
line 372, in textLine
self._code.append('%s T*' % self._formatText(text))
File "/usr/lib/python2.4/site-packages/reportlab/pdfgen/textobject.py",
line 333, in _formatText
text = text.decode('utf8')
AttributeError: 'tuple' object has no attribute 'decode'

Do I need to explicitly convert the list of tuples before feeding them to
ReportLab?

Rich

--
Richard B. Shepard, Ph.D. | The Environmental Permitting
Applied Ecosystem Services, Inc. | Accelerators(TM)
<http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863


More information about the reportlab-users mailing list