[ZPT] Unicode error in PageTemplates/XML

santi at zetadb.com santi at zetadb.com
Tue Dec 16 05:43:21 EST 2003


> Your xml would then look like:
>
> <?xml version="1.0" encoding="ISO-8859-15"?>
> <doc xmlns:tal="http://xml.zope.org/namespaces/tal">
>
>      <tal:b condition="python:request.RESPONSE.setHeader(
> 		'Content-Type','text/xml; charset=ISO-8859-15')" />
>
>    <body tal:content="here/give_me_content" />
> </doc>
>
> The tal:b bit sets the content type header with an explicit charset,
> which Zope uses to encode the result. Zope does not (yet) pick
> up the 'encoding=' element of the XML header.

Thanks.  I will not send the resultant xml to the user (it is part of an
OpenOffice document), but this is great to know.

> Use Unicode strings instead of latin encoded strings. If your data
> source
> is latin encoded, you might need to do "unicode(data,'iso-8859-15')" to
> convert your data to a Unicode.

It works fine !!  Now it seems obvious: all the page template is unicoded
before parse its xml, so use of encoded data crash.

Thanks very much for your help.

Santi Camps
http://zetadb.sourceforge.net






More information about the ZPT mailing list