Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save trycf/d3b33a164f28aad3d355120915f10824 to your computer and use it in GitHub Desktop.

Select an option

Save trycf/d3b33a164f28aad3d355120915f10824 to your computer and use it in GitHub Desktop.
TryCF Gist
<cfscript>
rc = {
"key0": "hello%252520world87%%20test",
"key1": "hello%252520world",
"key2": "hello%2520world 87%25"
}
rc.each( ( key, value ) => {
if ( !isNull( value ) && isSimpleValue( value ) ) {
rc[key] = rc[key].toString().reReplace( "%(?![0-9A-Fa-f]{2})", "%2525", "all" );
if ( rc[key].reFind( "%[0-9A-Fa-f]{2}" ) ) rc[key] = urlDecode( rc[key] );
rc[key] = rc[key].toString().reReplace( "%(?![0-9A-Fa-f]{2})", "%2525", "all" );
if ( rc[key].reFind( "%[0-9A-Fa-f]{2}" ) ) rc[key] = urlDecode( rc[key] );
}
} );
dump( rc );
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment