Encode & Decode URL Parameters In Java

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);


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *