CFLib.org – Common Function Library Project

fullUrlEncode(str)

Last updated February 11, 2015

author

Umbrae

Version: 2 | Requires: CF5 | Library: StrLib

Description:
This function gives the fully escaped URL encoding of a string.

Return Values:
Returns a string.

Example:

#fullurlencode('blah')#
<br>
#URLDecode(fullurlencode('this shows the compatibility with URLDecode and special characters. ^!*(-{}|'))#

Parameters:

Name Description Required
str String to encode. Yes

Full UDF Source:

/**
 * Give the fully escaped URL encoding of a string.
 * 
 * @param str      String to encode. (Required)
 * @return Returns a string. 
 * @author Umbrae (umbrae@gmail.com) 
 * @version 1, August 2, 2005 
 */
function fullurlencode(str) {
    var encstr="";
    var len=len(str);
    var i=1;
    for(i=1; i LTE len; i=i+1) {
        var char = FormatBaseN(Asc(Mid(str,i,1)),16);
        if(len(char) == 1) char = "0" & char;
        encstr = encstr & "%" & char;
    }
    return encstr;
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson