URL encoding is a way to translate special characters into a globally accepted format by web servers and browsers.
$url = "https://www.example.com?id=21&name=param"; $encodedurl = urlencode($url); echo $encodedurl;
var uri = "https://www.example.com?id=21&name=param"; var encoded = encodeURIComponent(uri); console.log(encoded);
var url = 'https://www.example.com?id=21&name=param'; var result = HttpUtility.UrlEncode(url);
You can easily encode urls using this online tool. To encode just enter a valid HTTP url into the textbox provided and press encode button.
You can also check similar URL Decode tool.