Quantcast
Channel: Lucee Dev - Latest topics
Viewing all articles
Browse latest Browse all 473

Add "base64url" as an encoding option for binaryEncode()

$
0
0

Right now, binaryEncode() and binaryDecode() support hex and base64 encodings. But, over the years, base64url has emerged as a common practice because it’s compact, like base64, but also removes several characters that are problematic in terms of URL-encoding.

It’s easy enough to implement this on your own:

var value = binaryEncode( bytes, "base64" )
    .replace( "+", "-", "all" )
    .replace( "/", "_", "all" )
    .replace( "=", "", "all" )
;

But, it would be nice to be able to just allow base64url to be passed around as an encoding argument and have it “just work”.

Looking at Lucee’s Coder.java implementation, it seems like it would be just one more else if to add.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 473

Trending Articles