A small code example describing how to encode and decode URL query strings properly from Java. The code example is available from GitHub in the in the Java-Core-Examples directory.
String paramValue = "with spaces and special &!=; characters";
String encoded = URLEncoder.encode(paramValue, "UTF-8");
String decoded = URLDecoder.decode(encoded, "UTF-8");
System.out.println(paramValue);
Leave a Reply