You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Chakradhar Tallam <c....@objectconsulting.com.au> on 2003/04/04 01:40:38 UTC

RE: Character encoding for form submissions

have a look at this

http://www.anassina.com/struts/i18n/i18n.html

-----Original Message-----
From: Morris Jones [mailto:mojo@whiteoaks.com]
Sent: Friday, April 04, 2003 9:42 AM
To: tomcat-user@jakarta.apache.org
Subject: Character encoding for form submissions


I've been researching this for a while.

I'm using Tomcat 4.1.18, and struts 1.0.2.

My app is successfully handling Unicode characters -- in all the actions,
stored in the database, displayed on the HTML pages, using charset=UTF-8.

But the only way I can find to get form data into Unicode in my form bean
is by manually transcoding the UTF-8 strings that come in into Unicode.

I'm led to believe that adding a filter to my app that calls
ServletRequest.setCharacterEncoding("UTF-8") will automatically transcode
the form data (from POST) into Unicode.  I can set breakpoints in
the filter and see that setCharacterEncoding() is being called, and
breakpoints in my form to see that the UTF-8 string from the form is
being set untouched.

What's the deal?  Is it really necessary to add conversion code to all of
my form beans?

Cheers,
Mojo
-- 
Morris Jones         <*>
San Rafael, CA
mojo@whiteoaks.com
http://www.whiteoaks.com


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org

RE: Character encoding for form submissions

Posted by Morris Jones <mo...@whiteoaks.com>.
Thanks Chakradhar, but that's where I got the filter to do
setCharacterEncoding().  I thought with that set Tomcat would convert the
strings to Unicode before setting them in my form beans, but it doesn't.
Like I said, I see the filter being called, and no different behavior.

Mojo

On Fri, 4 Apr 2003, Chakradhar Tallam wrote:

> have a look at this
> 
> http://www.anassina.com/struts/i18n/i18n.html
> 
> -----Original Message-----
> From: Morris Jones [mailto:mojo@whiteoaks.com]
> Sent: Friday, April 04, 2003 9:42 AM
> To: tomcat-user@jakarta.apache.org
> Subject: Character encoding for form submissions
> 
> 
> I've been researching this for a while.
> 
> I'm using Tomcat 4.1.18, and struts 1.0.2.
> 
> My app is successfully handling Unicode characters -- in all the actions,
> stored in the database, displayed on the HTML pages, using charset=UTF-8.
> 
> But the only way I can find to get form data into Unicode in my form bean
> is by manually transcoding the UTF-8 strings that come in into Unicode.
> 
> I'm led to believe that adding a filter to my app that calls
> ServletRequest.setCharacterEncoding("UTF-8") will automatically transcode
> the form data (from POST) into Unicode.  I can set breakpoints in
> the filter and see that setCharacterEncoding() is being called, and
> breakpoints in my form to see that the UTF-8 string from the form is
> being set untouched.
> 
> What's the deal?  Is it really necessary to add conversion code to all of
> my form beans?
> 
> Cheers,
> Mojo
> 

-- 
Morris Jones         <*>
San Rafael, CA
mojo@whiteoaks.com
http://www.whiteoaks.com


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org