home *** CD-ROM | disk | FTP | other *** search
- <!-----------------------------------------------------------
- This example illustrates use of the URLDecode function.
- ----------------------------------------------------------->
- <HTML>
- <HEAD>
- <TITLE>URLDecode</TITLE>
- </HEAD>
-
- <BASEFONT FACE="Arial, Helvetica" SIZE=2>
- <BODY bgcolor="#FFFFD5">
-
- <H3>URLDecode</H3>
- <P>
- Here is an example of the URLDecode and URLEncodedFormat functions.
- In this example, a string containing all ASCII character codes in
- the range 1-255 is created. The string is then encoded and decoded.
- The decoded value is compared with the original string to
- demonstrate their equality.
- </P>
- <cfscript>
- // Build string
- s = "";
- for (c = 1; c lte 256; c = c + 1)
- {
- s = s & chr(c);
- }
-
- // Encode string and display result
- enc = URLEncodedFormat(s);
- writeOutput("Encoded string is: '#enc#'.<br>");
-
- // Decode and compare result with original
- dec = URLDecode(enc);
- if (dec neq s)
- {
- writeOutput("Decoded is not the same as encoded.");
- }
- else
- {
- writeOutput("All's well on the Western front.");
- }
- </cfscript>
- </BODY>
- </HTML>
-