You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Saulius Grigaliūnas <sa...@gmail.com> on 2005/01/23 10:12:05 UTC
form encoding and utf-8 problems
Hello there cocoon community,
I've got some strange problems with form submiting and utf-8 encoding,
so i'm trying to write something in utf-8 in my form ( try it yourself
- http://dev.vzg.lt/Add/ ) and see what has been submited. After
submit I get some strange and really non utf-8 characters, what am I
doing wrong?
Here is the full configuration:
Pipeline
<map:match pattern="Add/">
<map:generate type="file" src="storage/xml/test.xml"/>
<map:transform type="xslt-saxon"
src="stylesheets/nauja.xsl" />
<map:serialize type="xhtml" />
</map:match>
<map:match pattern="Add/item">
<map:generate type="serverpages"
src="logic/xsp/addnews.xml"/>
<map:serialize type="xml" />
</map:match>
Serializers:
<map:serializer name="xhtml" mime-type="text/html;
charset=UTF-8" src="org.apache.cocoon.serialization.XMLSerializer">
<doctype-public>-//W3C//DTD XHTML 1.0
Strict//EN</doctype-public>
<doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</doctype-system>
<omit-xml-declaration>yes</omit-xml-declaration>
<encoding>UTF-8</encoding>
<omit-namespaces>yes</omit-namespaces>
<indent>yes</indent>
</map:serializer>
<map:serializer name="xml"
src="org.apache.cocoon.serialization.XMLSerializer"
mime-type="text/xml" logger="sitemap.serializer.xml" pool-grow="4"
pool-max="32" pool-min="4">
<encoding>UTF-8</encoding>
</map:serializer>
And simple xsp file content:
<page>
<xsp-request:get-character-encoding />
<br />
<xsp-request:get-parameter name="body" />
</page>
</xsp:page>
In web.xml I've got..
<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>
Cocoon 2.1.6 with Tomcat 5.0.30. So I guess this is it, looking
forward to your answers!
--
Saulius
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: form encoding and utf-8 problems
Posted by Timur Izhbulatov <ti...@yxo.ru>.
[ISO-8859-1] Aurйlien DEHAY писал(а):
> Saulius Grigaliunas wrote:
>> Hello Aurйlien,
>>
>>
>>
>>> Maybe you can look at the encoding of xsl file, or try with xalan. It
>>> was the only thing I change to make my forms utf-8 aware.
>>
>>
>> Well thanks for your help, that didn't work, but I accidently found
>> solution myself, in web.xml I've changed the configuration like this:
>> <init-param>
>> <param-name>form-encoding</param-name>
>> <param-value>utf-8</param-value>
>> </init-param>
>> and
>> <init-param>
>> <param-name>container-encoding</param-name>
>> <param-value>ISO-8859-1</param-value> <!-- <- and not utf-8 -->
>> </init-param>
>>
>> I don't really understand why it should be iso-8859-1 if everything is
>> encoded in utf-8 in my application, but if it works, that's alright
>> for me :).
>>
>>
>
> Well, I didn't changedthis configuration and left it commented in my
> web.xml, that's probably why it works for me.
>
>
> Rgds
That was discussed in the list before. Marc Portier recomended me refering
to source code to understand how does the container encoding actually works.
See
http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=109352638022695&w=2
I personaly don't even touch the container encoding parameter and just set
the form encoding parameter to utf-8 and use the same encoding in the
HTMLSerializer.
Timur
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: form encoding and utf-8 problems
Posted by Aurélien DEHAY <ad...@zorel.org>.
Saulius Grigaliunas wrote:
> Hello Aurélien,
>
>
>
>>Maybe you can look at the encoding of xsl file, or try with xalan. It
>>was the only thing I change to make my forms utf-8 aware.
>
>
> Well thanks for your help, that didn't work, but I accidently found
> solution myself, in web.xml I've changed the configuration like this:
> <init-param>
> <param-name>form-encoding</param-name>
> <param-value>utf-8</param-value>
> </init-param>
> and
> <init-param>
> <param-name>container-encoding</param-name>
> <param-value>ISO-8859-1</param-value> <!-- <- and not utf-8 -->
> </init-param>
>
> I don't really understand why it should be iso-8859-1 if everything is
> encoded in utf-8 in my application, but if it works, that's alright
> for me :).
>
>
Well, I didn't changedthis configuration and left it commented in my
web.xml, that's probably why it works for me.
Rgds
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: form encoding and utf-8 problems
Posted by Marc Portier <mp...@outerthought.org>.
Saulius,
you can find an explanation here:
http://wiki.apache.org/cocoon/RequestParameterEncoding?action=highlight&value=container-encoding
(with highlight of the section that might interest you most)
there is more in the mail archives of this list, since this has been
touched upon quite a lot.
the short answer on your remark: your application maybe codes everything
in utf-8, but the web-container (jetty or tomcat or...) is not.
cocoon uses the two parameters to correct the applied container-decoding
into the by you wanted form-encoding
regards,
-marc=
Saulius Grigaliunas wrote:
> Hello Aurélien,
>
>
>
>>Maybe you can look at the encoding of xsl file, or try with xalan. It
>>was the only thing I change to make my forms utf-8 aware.
>
>
> Well thanks for your help, that didn't work, but I accidently found
> solution myself, in web.xml I've changed the configuration like this:
> <init-param>
> <param-name>form-encoding</param-name>
> <param-value>utf-8</param-value>
> </init-param>
> and
> <init-param>
> <param-name>container-encoding</param-name>
> <param-value>ISO-8859-1</param-value> <!-- <- and not utf-8 -->
> </init-param>
>
> I don't really understand why it should be iso-8859-1 if everything is
> encoded in utf-8 in my application, but if it works, that's alright
> for me :).
>
>
--
Marc Portier http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
Read my weblog at http://blogs.cocoondev.org/mpo/
mpo@outerthought.org mpo@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re[2]: form encoding and utf-8 problems
Posted by Saulius Grigaliunas <sa...@gmail.com>.
Hello Aurélien,
> Maybe you can look at the encoding of xsl file, or try with xalan. It
> was the only thing I change to make my forms utf-8 aware.
Well thanks for your help, that didn't work, but I accidently found
solution myself, in web.xml I've changed the configuration like this:
<init-param>
<param-name>form-encoding</param-name>
<param-value>utf-8</param-value>
</init-param>
and
<init-param>
<param-name>container-encoding</param-name>
<param-value>ISO-8859-1</param-value> <!-- <- and not utf-8 -->
</init-param>
I don't really understand why it should be iso-8859-1 if everything is
encoded in utf-8 in my application, but if it works, that's alright
for me :).
--
Saulius
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: form encoding and utf-8 problems
Posted by Aurélien DEHAY <ad...@zorel.org>.
Saulius Grigaliunas wrote:
> Hello Aurélien,
>
>
>>Look at the cocoon's web.xml in WEB-INF and uncomment the following part:
>
>
>
>> <init-param>
>> <param-name>form-encoding</param-name>
>> <param-value>utf-8</param-value>
>> </init-param>
>
>
>>and It should work.
>
>
>>Rgds.
>
>
> Already done that, as I wrote in my first letter. Any other ideas?
>
>
Maybe you can look at the encoding of xsl file, or try with xalan. It
was the only thing I change to make my forms utf-8 aware.
Rgds.
Re[2]: form encoding and utf-8 problems
Posted by Saulius Grigaliunas <sa...@gmail.com>.
Hello Aurélien,
> Look at the cocoon's web.xml in WEB-INF and uncomment the following part:
> <init-param>
> <param-name>form-encoding</param-name>
> <param-value>utf-8</param-value>
> </init-param>
> and It should work.
> Rgds.
Already done that, as I wrote in my first letter. Any other ideas?
--
Saulius
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: form encoding and utf-8 problems
Posted by Aurélien DEHAY <ad...@zorel.org>.
Hello.
Saulius Grigaliunas wrote:
> Hello there cocoon community,
>
> I've got some strange problems with form submiting and utf-8 encoding,
> so i'm trying to write something in utf-8 in my form ( try it yourself
> - http://dev.vzg.lt/Add/ ) and see what has been submited. After
> submit I get some strange and really non utf-8 characters, what am I
> doing wrong?
>
Look at the cocoon's web.xml in WEB-INF and uncomment the following part:
<init-param>
<param-name>form-encoding</param-name>
<param-value>utf-8</param-value>
</init-param>
and It should work.
Rgds.