0

I used URLEncoder but this seems URLEncoder does not cover everything of url query parameter encoding (escaped). I searched and someone used URLEncoder to encode whole url. For my case I iust want to encode (escape) url query parameter values.

Here are some code I am used

 String url = "http://myserver.com?x=" + URLEncoder.encode(x_value, "UTF-8");

Anyone has any ideas? Thanks.

LHA
  • 9,398
  • 8
  • 46
  • 85
  • Did you try to use `URI` class? it allowes you to specify every single part of URL - host port query etc. – Antoniossss Dec 09 '13 at 14:55
  • I didn;t use URL before. I will give it a try. Thanks. – LHA Dec 09 '13 at 14:56
  • I found this link. It may help others. http://stackoverflow.com/questions/607176/java-equivalent-to-javascripts-encodeuricomponent-that-produces-identical-outpu – LHA Dec 11 '13 at 14:54

0 Answers0