At 7:25 AM -0700 2002/06/27, Struts Newsgroup (@Basebeans.com) wrote:
>Subject: form input in utf-8
>From: Torgeir Veimo <[EMAIL PROTECTED]>
>  ===
>What is the easiest way of telling struts that a form input is in utf-8
>format?
>
>I clearly see that the input comes in as utf-8, but it is interpreted as
>isolatin-1.

negotiating form encoding is a pretty horrible problem, and it's 
mostly outside of Struts' control.

There is an attribute to "form" in html 4.01, "accept-charset", but 
4.x browsers (which most of us still have to support) seem to totally 
ignore that.  To be honest, I'm not sure that the 6.0 browers handle 
it correctly either.  In any case, the struts <html:form> tag does 
not have this as one of its attributes.

<http://www.w3.org/TR/REC-html40/interact/forms.html#adef-accept-charset>

What has worked for us, mostly, is a combination of making sure that 
the encoding of the page containing the form is explicitly set, with 
a jsp directive or an HTML <meta> tag.  The counterpart, then, is a 
vendor-specific configuration that tells the application server what 
encoding to use.  For weblogic, it involves creating a 
/WEB-INF/weblogic.xml file with certain config parameters.

I'm pretty certain that Struts is bound to the web app container 
vendor's implementation of HttpServletRequest, which is responsible 
for converting the request bytes into strings 
(request.getParameter()).

By no means do I consider myself an expert on character encoding, 
despite having burned a lot of hours on problems (mostly with (c) and 
TM), so if anyone has more light to shed, it would be welcome...

Joe

-- 
--
* Joe Germuska    { [EMAIL PROTECTED] }
"It's pitiful, sometimes, if they've got it bad. Their eyes get 
glazed, they go white, their hands tremble.... As I watch them I 
often feel that a dope peddler is a gentleman compared with the man 
who sells records."
        --Sam Goody, 1956
tune in posse radio: <http://www.live365.com/stations/289268>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to