cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tamás Buresch (JIRA) <>
Subject [jira] Created: (COCOON-1917) Request Encoding problem: multipart/form vs. url encoded
Date Mon, 11 Sep 2006 17:11:22 GMT
Request Encoding problem: multipart/form vs. url encoded

                 Key: COCOON-1917
             Project: Cocoon
          Issue Type: Bug
          Components: * Cocoon Core
    Affects Versions: 2.1.8
            Reporter: Tamás Buresch

Although this bug was found in Cocoon 2.1.6., seems it is still present in 2.1.8. (by comparing
the source files)

Request parameters can be url-encoded (GET) or 'multipart/form' encoded (HTTP POST and form
encoding is set to multipart/form).
Cocoon decodes them differently, thus there are problems when HTML is encoded in UTF-8.

Reproducing the bug:
Create a simple xsp or action which dumps the request parameters.
Set the form encoding to UTF-8 and the container encoding to ISO-8859-1 in web.xml.

Use the following HTML fragment.

<!DOCTYPE html  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<HEAD><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></HEAD>
<FORM name="x" action="yourcocoon.html" method="post" enctype="multipart/form-data">
<INPUT type="text" name="utfText"> 
<INPUT type="submit">

Fill the form with characters having funny accents.
Trying POST and GET yields different results.
GET works, POST fails.
If the container encoding is set to UTF-8, then GET fails but POST works.

Here is a simple patch which partially fixes this bug.

In org\apache\cocoon\environment\http\ the line:


should be replaced with:

        // !!!   THIS IS JUST A PARTIAL FIX  !!!
        // The containerEncoding is irrelevant in case of MultipartHttpServletRequest.
        // This fix assumes that the client does not send the encoding information to 
        // the server in case of  multipart/form or it is equals to defaultFormEncoding.
        // Complete fix would be:
        // The encoding used in RequestFactory.getServletRequest() is passed to MultipartHttpServletRequest
        // and here that encoding is passed to this.request.setContainerEncoding().
        if (req instanceof MultipartHttpServletRequest) {
        } else {

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:


View raw message