Sample code for 30+ languages & platforms
Classic ASP

URL Encoding and Decoding

Demonstrates URL encoding/decoding using the HTTP convenience methods.

Chilkat Classic ASP Downloads

Classic ASP
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
set http = Server.CreateObject("Chilkat.Http")

s = "Hello World! 100% sure."

encoded = http.UrlEncode(s)
Response.Write "<pre>" & Server.HTMLEncode( "URL encoded: " & encoded) & "</pre>"

' Space → %20
' ! → %21
' % → %25

decoded = http.UrlDecode(encoded)
Response.Write "<pre>" & Server.HTMLEncode( "URL decoded: " & decoded) & "</pre>"

' Output:

' URL encoded: Hello%20World%21%20100%25%20sure.
' URL decoded: Hello World! 100% sure.

%>
</body>
</html>