Could an optional flag be added to specify variants on the Base64 encoding and decoding (see wikipedia for variants):
"Using standard Base64 in URL requires encoding of '+' and '/' characters into special percent-encoded hexadecimal sequences ('+' = '%2B' and '/' = '%2F'), which makes the string unnecessarily longer.
For this reason, a modified Base64 for URL variant exists, where no padding '=' will be used, and the '+' and '/' characters of standard Base64 are respectively replaced by '-' and '_', so that using URL encoders/decoders are no longer necessary and have no impact on the length of the encoded value, leaving the same encoded form intact for use in relational databases, web forms, and object identifiers in general."
(with a new hybrid that (as well as changing the + and / over) changes the ending '=' into a '|' so it can easily be used in any url string - some urls use '=' in parameter exchange - I'm suprised the left it in with the 'official' variant).
[Implemented] Flag for Base64Encoder / Decoder...
- DoubleDutch
- Addict
- Posts: 3220
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
[Implemented] Flag for Base64Encoder / Decoder...
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
https://reportcomplete.com <- School end of term reports system
Re: Flag for Base64Encoder / Decoder...
+1!
I've always had to fudge the trailing '=' to get it to validate in XML. This would be so very helpful.
I've always had to fudge the trailing '=' to get it to validate in XML. This would be so very helpful.
Re: Flag for Base64Encoder / Decoder...
+1
I've been using a homebrew Url64Encoder() procedure for a while, a built-in flag would be nice.
I've been using a homebrew Url64Encoder() procedure for a while, a built-in flag would be nice.
- DoubleDutch
- Addict
- Posts: 3220
- Joined: Thu Aug 07, 2003 7:01 pm
- Location: United Kingdom
- Contact:
Re: Flag for Base64Encoder / Decoder...
I just use the normal one, then do a ReplaceString - I then do the opposite on the convert back. It would be very handy to have the various types as an option though.
https://deluxepixel.com <- My Business website
https://reportcomplete.com <- School end of term reports system
https://reportcomplete.com <- School end of term reports system