You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Peter Flynn <pf...@ucc.ie> on 2009/04/03 15:39:00 UTC
Unexpected encoding in output
I have an RSS feed from our home page which is being generated by
pulling in the HTML and Tidying it:
<map:match pattern="ucc">
<map:generate src="http://www.ucc.ie/en/" type="html"/>
<map:transform src="xsl/ucc.xsl"/>
<map:serialize type="xml"/>
</map:match>
This works, except that the output starts with the XML Declaration
claiming <?xml version="1.0" encoding="ISO-8859-1"?>
But the home page is UTF-8, the ucc.xsl file is UTF-8, the xsl:output
inside it specifies UTF-8, and tidy.properties specifies
char-encoding=UTF-8.
Something, somewhere is interfering, and adding this
encoding="ISO-8859-1", but I'm at a loss where to look.
I also notice that all my generated HTML from Cocoon is being labelled
with <META http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1"> but I can't find where to turn this off.
///Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Unexpected encoding in output
Posted by Peter Flynn <pf...@ucc.ie>.
Petteri Sulonen wrote:
> (1) Check your web.xml. You should have the init-param "form-encoding"
> set to "UTF-8". (It's set by default to ISO-8859-1 on at least some
> versions of Cocoon.)
/var/lib/tomcat5/webapps/cocoon/WEB-INF/web.xml says:
> <!--
> Set encoding used by the container. If not set the ISO-8859-1 encoding
> will be assumed.
> Since the servlet specification requires that the ISO-8859-1 encoding
> is used (by default), you should never change this value unless
> you have a buggy servlet container.
> -->
> <init-param>
> <param-name>container-encoding</param-name>
> <param-value>ISO-8859-1</param-value>
> </init-param>
>
> <!--
> Set form encoding. This will be the character set used to decode request
> parameters. If not set the ISO-8859-1 encoding will be assumed.
> -->
> <init-param>
> <param-name>form-encoding</param-name>
> <param-value>ISO-8859-1</param-value>
> </init-param>
I changed both to UTF-8. No effect.
Incidentally, why is 8859-1 the default when XML's default is UTF-8?
This seems deeply suboptimal.
> (2) Check your sitemaps, starting from the Cocoon root sitemap. You can
> set the encoding of your serializers there, for example
>
> <map:serializer logger="sitemap.serializer.xml"
> mime-type="text/xml" name="xml"
> src="org.apache.cocoon.serialization.XMLSerializer">
> <encoding>UTF-8</encoding>
> </map:serializer>
>
> ...under /map:sitemap/map:components/map:serializers.
That did it. Very many thanks. There was no encoding element type in
there, so it would have been inheriting the default.
Is there some problem in making UTF-8 the default in the distro?
///Peter
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: Unexpected encoding in output
Posted by Petteri Sulonen <Pe...@avaintec.com>.
(1) Check your web.xml. You should have the init-param "form-encoding"
set to "UTF-8". (It's set by default to ISO-8859-1 on at least some
versions of Cocoon.)
(2) Check your sitemaps, starting from the Cocoon root sitemap. You can
set the encoding of your serializers there, for example
<map:serializer logger="sitemap.serializer.xml"
mime-type="text/xml" name="xml"
src="org.apache.cocoon.serialization.XMLSerializer">
<encoding>UTF-8</encoding>
</map:serializer>
...under /map:sitemap/map:components/map:serializers.
/Petteri
Peter Flynn wrote:
> I have an RSS feed from our home page which is being generated by
> pulling in the HTML and Tidying it:
>
> <map:match pattern="ucc">
> <map:generate src="http://www.ucc.ie/en/" type="html"/>
> <map:transform src="xsl/ucc.xsl"/>
> <map:serialize type="xml"/>
> </map:match>
>
> This works, except that the output starts with the XML Declaration
> claiming <?xml version="1.0" encoding="ISO-8859-1"?>
>
> But the home page is UTF-8, the ucc.xsl file is UTF-8, the xsl:output
> inside it specifies UTF-8, and tidy.properties specifies
> char-encoding=UTF-8.
>
> Something, somewhere is interfering, and adding this
> encoding="ISO-8859-1", but I'm at a loss where to look.
>
> I also notice that all my generated HTML from Cocoon is being labelled
> with <META http-equiv="Content-Type" content="text/html;
> charset=ISO-8859-1"> but I can't find where to turn this off.
>
> ///Peter
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org