[Product-Developers] Unicode and expat parseString

Wichert Akkerman wichert at wiggy.net
Mon Aug 4 15:19:48 UTC 2008


Previously Hedley Roos wrote:
> This one is mostly for Andreas (refer to 
> http://article.gmane.org/gmane.comp.web.zope.zope3/19953 )
> 
> I'm trying to get the British Pound sign (unichr 163) to be displayed in 
> a PDF. I use RMLPageTemplate, and the problem is in parseString as can 
> be seen from the traceback.
> 
>   Module ZPublisher.Publish, line 42, in call_object
>   Module Products.RMLPageTemplate.FSRMLPageTemplate, line 38, in __call__
>   Module Products.RMLPageTemplate.RMLPageTemplate, line 72, in __call__
>   Module Products.RMLPageTemplate.RMLPageTemplate, line 93, in view_asPDF
>   Module Products.RMLPageTemplate.RMLPageTemplate, line 85, in getPDF
>   Module trml2pdf.trml2pdf, line 531, in parseString
>   Module trml2pdf.trml2pdf, line 138, in __init__
>   Module xml.dom.minidom, line 1925, in parseString
>   Module xml.dom.expatbuilder, line 942, in parseString
>   Module xml.dom.expatbuilder, line 223, in parseString
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xa3' in 
> position 11755: ordinal not in range(128)

The problem is that RMLPageTemplate produces invalid XML which it feeds
to trml2pdf. I'm guessing it does not declare the encoding used or
declares it incorrectly. That is a bug which should be fixed.

Wichert.

-- 
Wichert Akkerman <wichert at wiggy.net>    It is simple to make things.
http://www.wiggy.net/                   It is hard to make things simple.




More information about the Product-Developers mailing list