--On 29. August 2006 12:28:30 -0300 Luiz Fernando Bernardes Ribeiro
<[EMAIL PROTECTED] > wrote:
> Hello all,
> Is it possible to change the encoding of a page without having to change
> default-zpublisher-encoding option in zope.conf?
> My default encoding is iso8859-1 but we have to generate some XML files
> to a
> flash app, but flash only accept utf-8.
If you edit your ZPTs through the ZMI you might set the manage_page_charset
to utf-8. If the content-type of your ZPT is set to text/xml then the
ZPublisher should auto-detect the encoding from the XML preamble. The
setting in zope.conf is just a fallback (at least in Zope 2.9+).
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 'default-zpublisher-encoding' setting solved the problem but I would have to convert hundreds of iso8859-1 html pages...
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...
Python script test.xml:
request = container.REQUEST
xml = [ ]
xml.append('<?xml version="1.0" encoding="utf-8"?>')
xml.append('<lista xmlns:metal="http://xml.zope.org/namespaces/metal" xmlns:tal=" http://xml.zope.org/namespaces/tal">')
xml.append('<item palavra="%s" id="%s" />' % ( container.sqlPalavras(ID=id).Apelido, id))
print unicode("\n".join(xml), 'iso8859-1')
I'm using Zope 2.9.
Thanks in advance for your help and time,
Luiz Fernando B. Ribeiro
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )