#2052 sys::Uri.encodeQuery does not conform standard

endragor Fri 9 Nov 2012

According to documentation, sys::Uri.encodeQuery is supposed to encode given map conforming to application/x-www-form-urlencoded MIME type which means the following:

Alphanumeric and -, ., _ characters are not encoded, spaces are replaced with +, and everything else is percent-encoded (line-endings are replaced with encoded CRLF).

Now it encodes parameter map conforming to RFC-3986 which is a standard for uri queries but not for POST-request form data.

This is a serious issue resulting in malformed post-request building by sys::WebClient.postForm method which uses sys::Uri.encodeQuery to encode form data.

brian Sat 10 Nov 2012

I don't think I fully understand

endragor Sun 11 Nov 2012

Consider this example:

echo(Uri.encodeQuery(["string":"Some string with spaces!"]))

results in:


but according to standard it should print:


brian Mon 12 Nov 2012

Promoted to ticket #2052 and assigned to brian

ok, will look

brian Mon 20 May 2013

Ticket resolved in 1.0.65

Looks like it worked correctly when query is part of URI, but just didn't work for that static helper method encodeQuery. Fixed across all native implementations.

Login or Signup to reply.