Question: can I be certain that Base64 encoded URLs won't output '/' characters?
Background: Firebase uses a key/value structure, and its key names, per the docs,
"can include any unicode characters except for . $ # [ ] / and ASCII control characters 0-31 and 127"
I'd like to use URLs as a key for one of my collection, but obviously the '/' and '.' make raw strings a no-go.
My plan (to which I'm not married) is to convert the URLs into Base64, using either the browser's functions (atob()
and btoa()
) or a dedicated function/NPM
module (as discussed here).
However, Base64 outputs can include '/', which breaks Firebase rules.
Would the characters a URL might contain ever produce a '/'?
If so, is there any reason I shouldn't just add a simple String.replace()
to the front/back of the Base64 encoding function?