I hope to encode a string to a url, but URLEncoder.encode()
cannot do it quite well:
URLEncoder.encode("http://www.example.com/1/hello world", "utf8")
will result in
http%3A%2F%2Fwww.example.com%2F1%2Fhello+world
What I hope to get is:
http://www.example.com/1/hello+world
without encoding the /
and :
characters.
EDIT
This is a just a simple example here, actually I have many non-ascii characters in the url.