2006/8/29, Andreas Jung &lt;<a href="mailto:lists@zopyx.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">lists@zopyx.com</a>&gt;:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<br><br>--On 29. August 2006 12:28:30 -0300 Luiz Fernando Bernardes Ribeiro<br>&lt;<a href="mailto:luiz.fernando.ribeiro@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">luiz.fernando.ribeiro@gmail.com
</a>&gt; wrote:<br><br>&gt; Hello all,<br>&gt;<br>&gt; Is it possible to change the encoding of a page without having to change
<br>&gt; the<br>&gt; default-zpublisher-encoding option in zope.conf?<br>&gt;<br>&gt; My default encoding is iso8859-1 but we have to generate some XML files<br>&gt; to a<br>&gt; flash app, but flash only accept utf-8.<br>

<br>If you edit your ZPTs through the ZMI you might set the manage_page_charset<br>to utf-8. If the content-type of your ZPT is set to text/xml then the<br>ZPublisher should auto-detect the encoding from the XML preamble. The
<br>setting in zope.conf is just a fallback (at least in Zope 2.9+).<br><br>-aj<br><br></blockquote></div><br>After trying a lot of things, I found the problem is really in the zpublisher realm, no matter what kind of encoding trick I use, even with a python script, the output is converted to the default encoding if I use any variable or dynamic value from the database. Changing the&nbsp; 'default-zpublisher-encoding' setting solved the problem but I would have to convert hundreds of iso8859-1 html pages...
<br><br>I have already recoded the XML inside a Python script where I think it will be easier to use any magic zope trick... so I'm asking a way to avoid changing zope.conf to produce this simgle xml file...<br><br>Python script 
test.xml:<br><br><span style="font-family: courier new,monospace;">request = container.REQUEST</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">xml = [ ]</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">xml.append('&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">xml.append('&lt;lista xmlns:metal=&quot;<a href="http://xml.zope.org/namespaces/metal">http://xml.zope.org/namespaces/metal</a>&quot; xmlns:tal=&quot;<a href="http://xml.zope.org/namespaces/tal">
http://xml.zope.org/namespaces/tal</a>&quot;&gt;')</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">xml.append('&lt;item palavra=&quot;%s&quot; id=&quot;%s&quot; /&gt;' % (
container.sqlPalavras(ID=id)[0].Apelido, id))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;"></span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">xml.append('&lt;/lista&gt;')</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
print unicode(&quot;\n&quot;.join(xml), 'iso8859-1')</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">return printed</span><br style="font-family: courier new,monospace;">
<br>I'm using Zope 2.9.<br><br><br>Thanks in advance for your help and time,<br clear="all"><br>-- <br>Luiz Fernando B. Ribeiro