cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Markus <t.mar...@proventis.net>
Subject Re: form encoding issues
Date Wed, 29 Sep 2010 09:26:44 GMT
  Hi,

check out request character encoding. For tomcat look at 
http://confluence.atlassian.com/display/DOC/Configuring+Tomcat%27s+URI+encoding 
and in your tomcat installation at 
webapps/examples/WEB-INF/classes/filters/SetCharacterEncodingFilter.java

that worked for me

regards
Thomas


Am 29.09.2010 11:11, schrieb Ron Van den Branden:
> Hi,
>
> I'm stumbling on a character encoding issue (cocoon-2.1.10) and really 
> can't see why. Apparently, text input in a form is passed on in a 
> wrong encoding. I've set Cocoon's default encoding in all thinkable 
> places as UTF-8:
>
> web.xml:
> ========
> <servlet>
> <servlet-name>Cocoon</servlet-name>
> <!-- .. -->
> <init-param>
> <param-name>container-encoding</param-name>
> <param-value>UTF-8</param-value>
> </init-param>
> <init-param>
> <param-name>form-encoding</param-name>
> <param-value>UTF-8</param-value>
> </init-param>
> <!-- ... -->
> </servlet>
>
> sitemap.xmap
> ============
> <map:serializer logger="sitemap.serializer.xhtml" 
> mime-type="text/html" name="xhtml"
> pool-max="${xhtml-serializer.pool-max}" 
> src="org.apache.cocoon.serialization.XMLSerializer">
> <doctype-public>-//W3C//DTD XHTML 1.0 Transitional//EN</doctype-public>
> <doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</doctype-system>

>
> <encoding>UTF-8</encoding>
> </map:serializer>
>
> Yet, when I execute following pipeline:
>
> <map:match pattern="test">
> <map:generate src="test.xml"/>
> <map:transform src="test.xsl">
> <map:parameter name="use-request-parameters" value="true"/>
> </map:transform>
> <map:serialize type="xhtml"/>
> </map:match>
>
> ...with following minimal source files:
>
> test.xml
> =======
> <?xml version="1.0" encoding="UTF-8"?>
> <test/>
>
> test.xsl (which will mainly echo the previous input)
> ======
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
> version="2.0">
> <xsl:param name="input"/>
> <xsl:template match="/">
> <html>
> <head>
> <meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
> </head>
> <body>
> <form action="test" accept-charset="UTF-8" method="get">
> <input type="text" value="{$input}" name="input"/>
> <input type="submit"/>
> </form>
> <p>current input: <xsl:value-of select="$input"/></p>
> </body>
> </html>
> </xsl:template>
> </xsl:stylesheet>
>
> Yet, entering a string with accented characters, like e.g. 'très 
> annoying', this comes out as: 'très annoying'...
> On the other hand, when entering the according URL 
> (<http://localhost:8888/test?input=tr%C3%A8s+annoying>) directly, the 
> characters are passed on correctly. Does anyone know how this can be 
> fixed?
>
> Any hints much appreciated!
>
> Ron Van den Branden
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message