Go is doing the right thing here. %2F is not escaping the / character,it is encoding it. a%2Fb and a/b are identical URIs.
The paths are not identical. The RFC (http://tools.ietf.org/html/rfc3986#section-2.4) states that the components and sub-components of a URI are separated before decoding.The path "a%2fb" is separated to the sub-component ["a%2fb"] and decoded to ["a/b"].The path "a/b" is separated to the sub-components ["a", "b"] and decoded to ["a", "b"].The godoc for net/url URL type describes how to work around this issue with the URL parser.
OK, my mistake
—Jens
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
On Friday, October 25, 2013 8:00:36 AM UTC-7, Toni Cárdenas wrote:If you are using github.com/gorilla/mux, this did the trick for me. https://github.com/tcard/mux/commit/7a711bc93a9da60fe8a288057d39ed6d7ce564ce
This is nice. A possible improvement is to have the mux decode the path variables. Using the OP's example URL and the pattern "/{artist}/{title}", the mux will set the path variables to artist="AC/DC" and title="Back In Black".