claesv
claesv

Reputation: 2113

Tomcat 6 doesn't decode + to space in parameter values

I have to OpenSUSE 10.4 machines running my webapp in Tomcat 6.0.32 (as provided by zypper), but in one of the instances '+' in parameter values is not decoded to ' ', and I can't figure out why. Any ideas?

Both tomcats have been configured manually, and so they might not be running with the same settings, but I can't think of a setting that would cause this behavior.

EDIT: Both instances use URIEncoding="UTF-8". I've also tried without setting the URIEncoding attribute, but it makes no difference in this case.

Upvotes: 0

Views: 1008

Answers (4)

darin
darin

Reputation: 11

On OpenSuSE 11.3 this is related specifically to the tomcat6-6.0.24-5.16.1 package and you can work around it by downgrading to the previous tomcat package. I ran into this with Confluence, https://jira.atlassian.com/browse/CONF-24659, and it took awhile to debug.

  1. downgrade tomcat:

    zypper install --force tomcat6-6.0.24-5.14.1.noarch
    
  2. Add a package lock to online_updates don't apply the busted package

    zypper addlock tomcat6

Upvotes: 1

Tor Händevik
Tor Händevik

Reputation: 61

I've got the exact same problem on some OpenSuSE 11.3 servers running tomcat6-6.0.24-5.16.1. My pages are encoded in ISO-8859-1 though.

Anyway, I've done some testing and noticed that if the parameters I submit in my test form contains non-ascii characters, such as Swedish ÅÄÖ or dollar or percent, the parameter is encoded/decoded correctly. But if the parameter value only contains regular ASCII chars, such as "This sucks", the encoding/decoding doesn't seem to be triggered, leaving spaces as +.

The problem does not exist if the form has enctype multipart/form-data.

Edit:

I can verify that updating Tomcat work. I updated to tomcat6-6.0.35-42.2.noarch.

Upvotes: 0

Jason
Jason

Reputation: 916

It is probably an issue with the specific Tomcat build on OpenSuSE. I am running OpenSuSE 11.4 and had this exact same issue. A simple YaST update corrected it.

Tomcat version that errored: tomcat6-6.0.32-7.12.1.noarch (really tomcat6-*-6.0.32-7.12.1.noarch)

Version that worked: tomcat6-6.0.32-7.14.1.noarch

Upvotes: 1

stzoannos
stzoannos

Reputation: 938

This might be an encoding issue.

Try adding the UTF-8 encoding to the Connector of [TOMCAT_HOME]/home/server.xml:

e.g:

<Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" />

Hope it helps.

Upvotes: 1

Related Questions