[reportlab-users] IronPython and UnicodeDecodeError again
Tom T.
mailinglisttank at googlemail.com
Wed Apr 25 02:51:28 EDT 2012
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.
myList = []
u = 'ö'
#u = u'\u00F6'
#u = u'\N{LATIN SMALL LETTER O WITH DIAERESIS}'
myList.append([Paragraph(u, normalStyle)])
File "C:\Programme\IronPython
2.7.1\lib\site-packages\reportlab\platypus\paragraph.py", line 60, in split
UnicodeDecodeError: ('unknown', u'\xf6', -1, 0, '')
# example 2
When I decode and encode the String it generates a PDF but the outputted
string are glyphs ('ö' in the example below).
u = u.decode('iso-8859-1').encode('utf8')
myList.append([Paragraph(u, normalStyle)])
# example 3
I also try to encode the string in ascii with the option
'xmlcharrefreplace' because Paragraph can handle html-tags. The result is
the same as in example 1.
u = u.decode('iso-8859-1').encode('ascii', 'xmlcharrefreplace')
myList.append([Paragraph(u, normalStyle)])
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. :(
Thanks a lot, Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20120425/66c0e9d8/attachment.html>
More information about the reportlab-users
mailing list