0

How I can get encoded(which java library can do this)

a & to a%20%26

without using String.replace() function?

URL Encoder -> a+%26

URIUtil.encodePath -> a%20&

UrlEscapers.urlFragmentEscaper().escape -> a%20&

  • URL Encoder encodes spaces to +, I need spaces to %20 – Kiril Belajev Jul 28 '17 at 10:37
  • Adding that you've already tried the built-in library and that it doesn't do what you want to your question would be helpful. (I suppose it does that for form encoding) – stuartd Jul 28 '17 at 10:39
  • 3
    Possible duplicate of [URLEncoder not able to translate space character](https://stackoverflow.com/questions/4737841/urlencoder-not-able-to-translate-space-character) – stuartd Jul 28 '17 at 10:41

1 Answers1

0

org.apache.catalina.util.URLEncoder is the answer