[reportlab-users] a guess about special characters
John Pywtorak
jpywtora at calpoly.edu
Mon Nov 7 12:54:03 EST 2005
Try escaping the & with something like
txt = txt.replace('&', '&')
Note you may also need to encode < and >. Additionally this assumes &
is not already encoded. You might want to use the cgi module I think
which has a method for this.
--
Windows
Start Here
Frustrating Hanging Crashing
Blue Screen of Death
Reboot
Dick Kniep wrote:
> Hi Carlos, list
>
> I have the same kind of problems. In the manual I have seen something about
> special characters, that says that you can replace the characters with a
> decimal replacement. However I still have a problem when I am using an
> ampersand ('&'). This sign should, according to the stdfonts.py be translated
> to \38, however, when I insert this into the string, I get an '8' back,
> instead of an ampersand.
>
> The error I get is:
>
> r.append(Paragraph(fld,parStyle))
> File "/usr/lib/python2.4/site-packages/reportlab/platypus/paragraph.py",
> line 378, in __init__
> self._setup(text, style, bulletText, frags, cleanBlockQuotedText)
> File "/usr/lib/python2.4/site-packages/reportlab/platypus/paragraph.py",
> line 403, in _setup
> raise "xml parser error (%s) in paragraph beginning\n'%s'"\
> xml parser error (; missing in entityref) in paragraph beginning
> 'Den Besten&Sloof'
>
> Note the '&'. As soon as I remove this, it works fine. Now I need a way to
> avoid this problem, because there is no way for me to predict what kind of
> content is sent to the paragraph.
>
> Anyone any ideas?
>
> Op maandag 3 oktober 2005 18:26, schreef Carlos Roberto Martínez:
>
>>Hi, I from El Salvador an I speak spanish.
>>I have problems when I use paragraph() function for
>>write special characters like "á" or "É" (spanish
>>language). Reportlab prints stranges characters.
>>Can you help me? Thanks
>>
>>__________________________________________________
More information about the reportlab-users
mailing list