Saturday, July 27, 2013

URL path segment encoding

Java's URLEncoder class is not suitable for encoding path segments in URLs. It's not even really suitable for encoding GET parameters in the query part of a URL, e.g. it encodes unreserved URI characters, which should not be encoded, such as tilde (~).

Spring has a good encoder. Now Play does too. :)

RFC 1738 is obsolete, so don't just go and percent-encode the characters it lists as unsafe. Encoding such characters may violate the newer RFC 3986. Ignore instructions that say otherwise!

No comments:

Post a Comment