WL-3090 : URL shortener doesn't deal correctly with escaped characters in the URL being shortened.

To encode the URL, I initially used URLEncoder.encode(url, "UTF-8") but annoyingly that encodes a URL like this:

http://localhost:8080/access/content/group/c3e86560-eb0f-4799-8944-41440c42e936/ó 24 â ë.html

as this:

http%3A%2F%2Flocalhost%3A8080%2Faccess%2Fcontent%2Fgroup%2Fc3e86560-eb0f-4799-8944-41440c42e936%2F%C3%B3+24+%C3%A2+%C3%AB.html

It encodes spaces  as '+' signs rather than '%20' (which it is meant to do apparently  - http://stackoverflow.com/questions/4737841/urlencoder-not-able-to-translate-space-character).
Also it encodes all the colons and forwards slashes which isn't needed and doesn't get translated in the browser. 

So I'm using apache httpclient's  URIUtil.encodeQuery(rawUrl) which correctly (for out purposes) encodes the above URL as:

http://localhost:8080/access/content/group/c3e86560-eb0f-4799-8944-41440c42e936/%C3%B3%2024%20%C3%A2%20%C3%AB.html.

Lastly, whilst some encoding was attempted when got from the db,  the URL wasn't being encoded at all  when it was got from the cache.