Skip to content

Instantly share code, notes, and snippets.

@indywidualny
Last active November 14, 2015 03:21
Show Gist options
  • Save indywidualny/a3da6094977e017d987b to your computer and use it in GitHub Desktop.
Save indywidualny/a3da6094977e017d987b to your computer and use it in GitHub Desktop.
URL decoder
// url decoder, recreate all the special characters
private static String urlDecode (String url) {
return url.replace("%3C", "<").replace("%3E", ">").replace("%23", "#").replace("%25", "%")
.replace("%7B", "{").replace("%7D", "}").replace("%7C", "|").replace("%5C", "\\")
.replace("%5E", "^").replace("%7E", "~").replace("%5B", "[").replace("%5D", "]")
.replace("%60", "`").replace("%3B", ";").replace("%2F", "/").replace("%3F", "?")
.replace("%3A", ":").replace("%40", "@").replace("%3D", "=").replace("%26", "&")
.replace("%24", "$").replace("%2B", "+").replace("%22", "\"").replace("%2C", ",")
.replace("%20", " ");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment