You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What version of Go are you using (go version)?
1.6.2
What operating system and processor architecture are you using (go env)?
linux amd64
What did you do? https://play.golang.org/p/loaa8vvCli
Attempted to use net/url to encode a component of a URI which contained both forward-slashes and whitespace.
What did you expect to see?
A method akin to JS encodeURIcomponent which would encode the component the way I need.
What did you see instead?
No solution, as of yet.
I'm interacting with an API where I need to escape individual URI components. In my specific case, I'm escaping components containing whitespace and forward slashes. As demonstrated above, net/url seems to have no method which I can use to accomplish this. Any url.Parse() related function will ignore forward slashes, as it should. I also can't rely on something such as url.QueryParse(), as query string encoding turns whitespace into +.
Would it be possible for net/url to add functionality akin to JS's encodeURIcomponent to cover cases such as this?
The text was updated successfully, but these errors were encountered:
alienth
changed the title
net/url: No adequate method exists for escaping a URI component containing forward-slashes
net/url: No adequate method exists for escaping a URI component
Jun 29, 2016
alienth
changed the title
net/url: No adequate method exists for escaping a URI component
net/url: No adequate method exists for encoding a URI component
Jun 29, 2016
We use the issue tracker both for bugs and for proposals. That is what https://golang.org/wiki/Questions says, so I'm not clear on the disagreement you mention.
go version
)?1.6.2
go env
)?linux amd64
https://play.golang.org/p/loaa8vvCli
Attempted to use net/url to encode a component of a URI which contained both forward-slashes and whitespace.
A method akin to JS
encodeURIcomponent
which would encode the component the way I need.No solution, as of yet.
I'm interacting with an API where I need to escape individual URI components. In my specific case, I'm escaping components containing whitespace and forward slashes. As demonstrated above,
net/url
seems to have no method which I can use to accomplish this. Anyurl.Parse()
related function will ignore forward slashes, as it should. I also can't rely on something such asurl.QueryParse()
, as query string encoding turns whitespace into+
.Would it be possible for
net/url
to add functionality akin to JS'sencodeURIcomponent
to cover cases such as this?The text was updated successfully, but these errors were encountered: