NET-A-PORTER/scala-uri

Characters after '#' is encoded even if part of valid URL

Closed this issue · 4 comments

hjz commented

AngularJS's routing system creates URLs of the scheme /#/<:page:>, e.g:

https://www.foo.com/#/myPage?token=bar

This gets encoded into:

https://www.foo.com/#%2FmyPage-%3Ftoken%bar

Which breaks the routing.

I think this is effectively the same issue as I described in #97 (though I only pointed out the unnecessary escaping of =).

I'm experiencing this issue too

hjz commented

Google groups uses has a similar issue

https://groups.google.com/forum/#!forum/elasticsearch

theon commented

Sorry for the delay. This should be fixed in 0.4.11 so that only the # character gets percent encoded by default in the fragment.

You should be able to also get the desired result on older versions by bringing an custom implicit UriConfig into scope where you render the URL, like so:

implicit val config = UriConfig.default.copy(fragmentEncoder = PercentEncoder(`#`))