cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vadim Gritsenko" <vadim.gritse...@verizon.net>
Subject RE: i18n repost
Date Wed, 17 Apr 2002 23:49:39 GMT
> From: Alexander Smirnoff [mailto:asmirnoff@vistar.ca]
> 
> OK. I found the problem:
> 
> Tomcat by default uses ISO-8859-1 encoding when you submitting
> a form. So to correct the problem you have to translate it :
> 
> String newstr = new String(<xsp-request:get-parameter
> name="par"/>.getBytes("ISO-8859-1"));
> 
> Well, the question is :
> 
> Is there any way to do this automaticly from the sitemap/cocoon.xconf
> or etc.?

I sense FAQ in here... Couple of days ago I suggested to other guy to
use
  
  request.setCharacterEncoding("utf-8");

In XSP this will look like:

  request.setCharacterEncoding (check spelling with JavaDoc)
  String param = <xsp-request:get-parameter name="par"/>

(Note: setCharacterEncoding must be called before any access to
request's parameters! But you will read this in javadoc anyway)

Or you can put setCharacterEncoding call into an action, and it will set
character encoding for all XSPs at once.


And there is another solution which exist since day one (or almost one
;) :

  String param = <xsp-request:get-parameter name="par"
form-encoding="utf-8" container-encoding="iso-8859-1"/>


Vadim


> I'm using Tomcat 4.0.1, Cocoon 2.0
> 
> Alex.
> 
> > I know that this question maybe is not for Cocoon list.
Nevertheless,
> >
> > I've set
> >
> > <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
> >
> > in the html form.
> >
> > When submitting the form with national characters (Russian) I
recieve
> > parameters in unreadable charset. I'm not good neither in HTTP  nor
in
> > internationalization. Could anybody explain how to parse it
correctly to
> > convert whatever it is into correct UTF8 string?
> >
> > Thanks,
> > Alex.


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message