Decodes a URL-encoded string.
urlDecode(urlencodedstring [, charset])
returns string
Name | Type | Required | Default | Description | Values | |
---|---|---|---|---|---|---|
urlencodedstring | string | Yes | ||||
charset | string | No | The character encoding in which the string is encoded. | /Users/garethedwards/development/github/cfdocs/docs/functions/urldecode.md | utf-16 |
Shows how it takes an input of: %21 and returns: !
urlDecode("%21")
In this example we demonstrate taking a URL encoded message passed on the request context and displaying it decoded.
if( len( rc.msg ) ) {
writeOutput( encodeForHTML( urlDecode( rc.msg ) ) );
}
In this example we demonstrate url encoding a password before it is encrypted, and then decoding it after it is decrypted.
pwd = urlEncodedFormat( '$18$f^$XlTe41' );
writeOutput( pwd & ' : ' );
pwd = encrypt( pwd, '7Z8of/gKWpqsx/v6O5yHRKanrXsp93B4xIHV97zf88Q=', 'BLOWFISH/CBC/PKCS5Padding', 'HEX' );
writeOutput( pwd & ' : ' );
decpwd = decrypt( pwd, '7Z8of/gKWpqsx/v6O5yHRKanrXsp93B4xIHV97zf88Q=', 'BLOWFISH/CBC/PKCS5Padding', 'HEX' );
writeOutput( decpwd & ' : ' );
decpwd = urlDecode( decpwd );
writeOutput( decpwd );
In this example we demonstrate taking a URL encoded message passed on the request context and displaying it decoded using the urlDecode() member function.
if( len( rc.msg ) ) {
writeOutput( encodeForHTML( rc.msg.urlDecode() ) );
}