Hi,

to get the encoding right the outgoing encoding (JSP-page) and the incoming encoding 
have to bet he same. You should define the enconfig of the JSP by:

1. Setting the content-type in the HTML Page
<META http-equiv="Content-type" content="text/html;charset=UTF-8">

2.  Defining the contentType;charset for the JSPC
<[EMAIL PROTECTED] contentType="test/html:charset=UTF-8"%>

3. Defining The encoding type and charset of the form:
<html:form ... enctype="application/x-www-form-urlencoded; charset=UTF-8">

The Opera and Firefox Browsers provide better informations about the content encoding 
than the IE. You should check the encoding in one of those. The browser may choose a 
different charset for displaying the page (and form) and you won't get UTF-8 data back.

This procedure worked fine on at least two major projects.

Regards,
Niclas


-----Original Message-----
From: Larry Young [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 21, 2004 9:39 PM
To: Struts Users Mailing List
Subject: Re: character encoding

Carl-Eric,

         Yes, I tried the charset on the form but found it didn't do any good.

         But what do you force the Encoding to in your Filter?  How can you 
know with any certitude how the browser encoded the data values before 
sending it to you??  It probably works well if the browser is setup to 
"auto-select" the encoding, but what do you do if they have it explicitly 
set to something other than what you are assuming?

--- regards ---
Larry


At 12:07 PM 7/21/04, you wrote:

> >          I'd like to hear how others have solved this problem.  I can see
> > that one solution is to replace the RequestProcessor and hardcode the
> > "setEncoding" on the Request to UTF-8, or subclass the whole
> > ActionServlet.  Are there any cleaner solutions?  I can't believe I'm the
> > only one to have run across this problem!  I'm not THAT unlucky! :)
>
>I am using a Filter (from the Servlet API) that gets the request
>before anything else in the chain and calls setEncoding() on it before
>passing it on.
>
>What would be great, just to get a little more consistency into this,
>would be if the html:form-tag would finally support the accept-charset
>attribute as specified in HTML4.01.
>
>HTH
>Carl-Eric
>--
>Antwort: Weil es das Lesen des Textes erschwert.   | Carl-Eric Menzel
>Frage  : Warum ist das so schlimm?                 | PGP ID: 808F4A8E
>Antwort: Antworten oben zu schreiben.              | Bitte keine HTML-
>Frage  : Was ist die schlimmste Unsitte in Emails? | Mails schicken.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]

--------------------------
Larry Young
The Dalmatian Group
www.dalmatian.com 



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

Reply via email to