[ZPT] Setting encoding in xml declaration

Fred Drake fdrake at gmail.com
Mon May 30 09:30:01 EDT 2005


On 5/28/05, Tom von Schwerdtner <tvon at etria.com> wrote:
> I'm not having any luck with this, so maybe someone here can help.
> 
> 1- I need to generate a RDF document with TAL
> 
> 2- I need to set the encoding in the XML declaration

Are you sure you have to set this dynamically?  This seems odd.  You
should be able to use one of the encodings for which support is
required, like UTF-8, and have a static XML declaraction:

<?xml version="1.0" encoding="utf-8"?>

> 3- If I generate the XML declaration with something like this:
> 
>    <tal:block
>         replace="structure string:<?xml version='1.0' encoding='${encoding}'?>"/>
> 
>   Then TAL seems to treat the file is HTML (since there is no hard-coded
> XML declaration I assume) and lower cases all tags.  This turns <rdf:RDF
> into <rdf:rdf which is invalid.

You'd probably benefit by avoiding the HTML/XML auto-detection code. 
It shouldn't be too hard to create a page template subclass that
skipped that.  You didn't given enough details to just throw that out,
though.  (Zope 2 or Zope 3?  Filesystem or TTW?)


  -Fred

-- 
Fred L. Drake, Jr.    <fdrake at gmail.com>
Zope Corporation


More information about the ZPT mailing list