Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trycf/988897dcb533f472e69c5166406bf6dc to your computer and use it in GitHub Desktop.
Save trycf/988897dcb533f472e69c5166406bf6dc to your computer and use it in GitHub Desktop.
TryCF Gist
<cfscript>
function urlSafeBase64Encode(str) {
return createObject("java", "java.util.Base64")
.getUrlEncoder()
.withoutPadding()
.encodeToString(str.getBytes("UTF-8"));
}
str = "subjects?_d=1"
base64 = toBase64(str);
writeDump({ "Standard Base64": base64});
urlSafeBase64 = urlSafeBase64Encode(str);
writeDump({ "URL Safe Base64": urlSafeBase64 });
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment