struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Miguel Galves" <mgal...@gmail.com>
Subject Re: multipart/form-data and character encoding
Date Mon, 29 May 2006 18:47:25 GMT
Antonis,

we had the same problem with multi part forms. We tried everithing,
including enctype in the
form tag, URIEncoding, and request.setEncoding...in reset() method. All
theses solutions worked
fine with all kinds of requests, except for the mulipart, which is handled
in a different way.

The only solution that really worked for us was to create a subclass of
TilesRequestProcessor,
and override the handleRequest method as follows:

public class ScyllaRequestProcessor extends TilesRequestProcessor {

    public void process(HttpServletRequest request, HttpServletResponse
response) throws IOException,

ServletException {
        try {
            request.setCharacterEncoding("UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        super.process(request, response);
    }

To use this processor, just change the controller entry in struts-config.xml

[]s

Miguel


On 5/29/06, Martin Gainty <mgainty@hotmail.com> wrote:
>
> Good Afternoon Antonis-
>
> This character encoding issue has been addressed
> http://issues.apache.org/struts/browse/STR-2117 as follows
>
> Set your page to use correct character encoding
> <%@ page ....;contentType="text/html" charset=UTF-8"%>
>
> Set form to use correct form encoding
> <html:form action....method...enctype="application/x-www-form-urlencoded;
> charset=UTF-8">
>
> Instruct web container to use selected charset when creating request (in
> server.xml)
> <Connector port..URIEncoding="UTF-8".../>
>
> HTH,
> Martin --
> ----- Original Message -----
> From: "Antonis Lebesis" <ant.lebesis@gmail.com>
> To: <user@struts.apache.org>
> Sent: Monday, May 29, 2006 2:07 PM
> Subject: multipart/form-data and character encoding
>
>
> Hi,
> I 've searched the archives but haven't found any solution to my
> latest problem. I have with a <html:file> input and a <html:text>
> input. The problem is that request.getCharacterEncoding() returns null
> and the text input is considered to be in iso-8859-1 encoding. In the
> corresponding ActionForm's reset(), I have added the following line:
> request.setCharacterEncoding("ISO-8859-7");
>
> In forms that don't have a <html:file> input, the character set is
> correct. The problem occurs only in this form and from what I 've
> found it is caused by the fact that in the form declaration I have
> added enctype="multipart/form-data".
>
> Has anyone solved this problem?
>
> Thanks,
> Antonis
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
Miguel Galves - Engenheiro de Computação
Já leu meus blogs hoje?
Para geeks http://log4dev.blogspot.com
Pra pessoas normais
http://miguelgalves.blogspot.com

"Não sabendo que era impossível, ele foi lá e fez..."

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message