Opened 11 years ago

Last modified 3 years ago

#105 released defect (fixed)

Plus sign is not encoded

Reported by: Artur Signell Owned by: Marc Englund
Priority: blocker Milestone: 4.0.0-beta-1-rc
Component: WebTerminalAdapter Version:
Keywords: encoding Cc:
Depends on:
Workaround:
Verified:
Fv: no Pro Account: Mark as Priority

Description

Writing + in a Textfield is not encoded and is thus interpreted as a space.
Writing e.g. +€ in a textfield causes a stack trace and the data not to be sent to the application at all.

java.io.CharConversionException: isHexDigit

at org.apache.tomcat.util.buf.UDecoder.convert(UDecoder.java:124)
at org.apache.tomcat.util.buf.UDecoder.convert(UDecoder.java:87)
at org.apache.tomcat.util.http.Parameters.processParameters(Parameters.java:408)
at org.apache.coyote.tomcat4.CoyoteRequest.parseRequestParameters(CoyoteRequest.java:1962)
at org.apache.coyote.tomcat4.CoyoteRequest.getParameter(CoyoteRequest.java:909)
at org.apache.coyote.tomcat4.CoyoteRequestFacade.getParameter(CoyoteRequestFacade.java:178)
at com.itmill.millstone.ajaxadapter.ApplicationManager.handleXmlHttpRequest(ApplicationManager.java:114)
at com.itmill.millstone.ajaxadapter.AjaxAdapterServlet.service(AjaxAdapterServlet.java:188)

Change history (8)

comment:1 Changed 11 years ago by Artur Signell

Can be fixed by changing

changes += i + "=" + this.variableStates[i] + "&";

to

changes += i + "=" + this.variableStates[i].replace("+","%2B") + "&";

in client.js.

Maybe not the "right" way to fix it but it seems to work. Don't know if this same thing happens with other characters or in other places in client.js / theme.js. At least unicode characters seem to be encoded correctly.

comment:2 Changed 11 years ago by anonymous

It seems that plus sign (+) is not the only problem, but all unicode characters are wrongly encoded as %u<4*hex>.

comment:3 Changed 11 years ago by anonymous

  • Milestone set to Release Candidate 4.0.0-beta

comment:4 Changed 11 years ago by Artur Signell

The following should be a correct fix:

In client.js change:

activeRequest.setRequestHeader('Content-Type',

'application/x-www-form-urlencoded')

to

activeRequest.setRequestHeader('Content-Type',

'application/x-www-form-urlencoded; charset=UTF-8')

and

this.variableStates[name] = escape(value);

to

this.variableStates[name] = encodeURIComponent(value);

comment:5 follow-up: Changed 11 years ago by anonymous

  • Resolution set to fixed
  • Status changed from new to closed

comment:6 in reply to: ↑ 5 Changed 11 years ago by Joonas Lehtinen

Replying to anonymous:

PLEASE do login when posting... (otherwise this suspicious anonymous fixer takes all your credits :) )

comment:7 Changed 4 years ago by Artur Signell

  • Fv unset

comment:8 Changed 3 years ago by Artur Signell

  • Status changed from closed to released
Note: See TracTickets for help on using tickets.